Module: Moarspec::Its::With
- Defined in:
- lib/moarspec/its/with.rb
Instance Method Summary collapse
-
#it_with(**lets, &block) ⇒ Object
Creates a nested context + example with ‘let` values defined from the arguments.
Instance Method Details
#it_with(**lets, &block) ⇒ Object
Creates a nested context + example with ‘let` values defined from the arguments.
See also #its_block_with for a block form, and #instant_context for inline ‘context`+`let` definitions.
25 26 27 28 29 30 31 32 |
# File 'lib/moarspec/its/with.rb', line 25 def it_with(**lets, &block) context "with #{lets.map { "#{_1}=#{_2.inspect}" }.join(', ')}" do lets.each do |name, val| let(name) { val } end example(nil, &block) end end |