Module: Cuprum::Collections::RSpec::Contracts::Scopes::CriteriaContracts::ShouldParseCriteriaContract Deprecated
- Extended by:
- RSpec::SleepingKingStudios::Contract
- Defined in:
- lib/cuprum/collections/rspec/contracts/scopes/criteria_contracts.rb
Overview
Deprecated.
0.6.0
Contract validating the parsing of criteria.
Instance Method Summary collapse
-
#apply(example_group) ⇒ Object
Adds the contract to the example group.
Instance Method Details
#apply(example_group) ⇒ Object
Adds the contract to the example group.
1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 |
# File 'lib/cuprum/collections/rspec/contracts/scopes/criteria_contracts.rb', line 1223 contract do describe 'with a block' do include_contract 'should parse criteria from a block' end describe 'with a hash' do include_contract 'should parse criteria from a hash' end describe 'with a hash and a block' do let(:operators) { Cuprum::Collections::Queries::Operators } let(:block) do lambda do |scope| { 'author' => scope.one_of('J.R.R. Tolkien', 'Ursula K. LeGuin') } end end let(:value) do { 'category' => 'Science Fiction and Fantasy' } end let(:expected) do [ [ 'category', operators::EQUAL, 'Science Fiction and Fantasy' ], [ 'author', operators::ONE_OF, ['J.R.R. Tolkien', 'Ursula K. LeGuin'] ] ] end it 'should parse the criteria' do expect(parse_criteria(value, &block)).to be == expected end end end |