Module: Moarspec::Its::BlockWith
- Defined in:
- lib/moarspec/its/block_with.rb
Instance Method Summary collapse
-
#its_block_with(**lets, &block) ⇒ Object
Creates a nested context + example with ‘let` values defined from the arguments, and the subject treated as a block.
Instance Method Details
#its_block_with(**lets, &block) ⇒ Object
Creates a nested context + example with ‘let` values defined from the arguments, and the subject treated as a block.
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/moarspec/its/block_with.rb', line 24 def its_block_with(**lets, &block) context "with #{lets.map { "#{_1}=#{_2.inspect}" }.join(', ')} as block" do lets.each do |name, val| let(name) { val } end def is_expected # rubocop:disable Lint/NestedMethodDefinition expect { subject } end example(nil, &block) end end |