Class: Funktional::AssignedShouldBlock
- Inherits:
-
ShouldBlock
- Object
- ShouldBlock
- Funktional::AssignedShouldBlock
- Defined in:
- lib/funktional/context/assigned_should_block.rb
Instance Method Summary collapse
-
#initialize(recorder, context) ⇒ AssignedShouldBlock
constructor
A new instance of AssignedShouldBlock.
- #test_name_parts ⇒ Object
Methods inherited from ShouldBlock
Constructor Details
#initialize(recorder, context) ⇒ AssignedShouldBlock
Returns a new instance of AssignedShouldBlock.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/funktional/context/assigned_should_block.rb', line 4 def initialize(recorder, context) @recorder, @context = recorder, context @should_name = "the assigned(#{@recorder.__target})" @blk = lambda do result = nil recorder.__each_called do |meth, args, block| if result.nil? result = assigned(recorder.__target).send(meth, *args, &block) else result.send(meth, *args, &block) end end end end |
Instance Method Details
#test_name_parts ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/funktional/context/assigned_should_block.rb', line 21 def test_name_parts call_chain = '' @recorder.__each_called do |meth, args| call_chain << ".#{meth}" unless meth.eql? :should_be end @should_name << "#{call_chain} should be [#{@recorder.__last_value}]" return ["test:", "#{@context.full_name},", "#{@should_name}"] end |