Module: Canned::Context::Matchers::Has
Instance Method Summary collapse
-
#has(_key, _options = {}, &_block) ⇒ Object
(also: #have)
Acts on one of the top resource’s attributes.
Instance Method Details
#has(_key, _options = {}, &_block) ⇒ Object Also known as: have
Acts on one of the top resource’s attributes
Examples:
upon { loaded(:raffle).has(:app_id) { equal_to(20) or less_than(20) } }
upon { loaded(:raffle).has('ceil(upper)').greater_than(20)
12 13 14 15 16 17 |
# File 'lib/canned/context/matchers/has.rb', line 12 def has(_key, ={}, &_block) _chain_context(Canned::Context::Value, _block) do |stack| value = Helpers.resolve(stack.top, _key) stack.push(:value, .fetch(:as, _key), value) end end |