This gem provides shoulda-style matchers for Rspec to GrapeEntity.
Here are some examples of the matchers in use:
it { should represent(:date_of_birth).as(:brithday) }
it { should_not represent(:name).as(:brithday) }
it { should_not represent(:date_of_birth) }
it { should represent(:secret).when( :authorized? => true ) }
it { should_not represent(:secret).when( :authorized? => false ) }
it { should represent(:super_dooper_secret).as(:top_secret).when( :authorized? => true ) }
it { should_not represent(:super_dooper_secret).as(:top_secret).when( :authorized? => false ) }
it { should represent(:dog).using(PetEntity) }
it { should represent(:cat).as(:kitty).using(PetEntity) }
Add this line to your application's Gemfile:
gem 'grape-entity-matchers', :group => :test
And then execute:
$ bundle
Or install it yourself as:
$ gem install grape-entity-matchers
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
MIT License. See LICENSE for details.
Copyright (c) 2013 Mark Madsen, and AGiLE ANiMAL INC.