This gem provides shoulda-style matchers for Rspec to GrapeEntity.
Currently compatible Rspec 3.
Here are some examples of the matchers in use:
it { is_expected.to represent(:date_of_birth).as(:birthday) } it { is_expected.to_not represent(:name).as(:birthday) } it { is_expected.to_not represent(:date_of_birth) } it { is_expected.to represent(:secret).when( :authorized? => true ) } it { is_expected.to_not represent(:secret).when( :authorized? => false ) } it { is_expected.to represent(:super_dooper_secret).as(:top_secret).when( :authorized? => true ) } it { is_expected.to_not represent(:super_dooper_secret).as(:top_secret).when( :authorized? => false ) } it { is_expected.to represent(:dog).using(PetEntity) } it { is_expected.to represent(:cat).as(:kitty).using(PetEntity) } it { is_expected.to represent(:name).with_documentation(type: String) } it { is_expected.to document(:name).with(type: String, desc: 'Name of the person') } it { is_expected.to document(:name).type(String).desc('Name of the person') }
Rspec 2.0.0 is no longer supported. For Rspec 2 use version 0.4.0.
It's coming next.
Add this line to your application's Gemfile:
gem 'grape-entity-matchers', :group => :test
And then execute:
Or install it yourself as:
$ gem install grape-entity-matchers
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)MIT License. See LICENSE for details.
Copyright (c) 2014 Mark Madsen, and AGiLE ANiMAL INC.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4