Class: Funktional::CountShouldBlock

Inherits:
ShouldBlock show all
Defined in:
lib/funktional/context/count_should_block.rb

Instance Method Summary collapse

Methods inherited from ShouldBlock

build, #to_test

Constructor Details

#initialize(recorder, context) ⇒ CountShouldBlock

Returns a new instance of CountShouldBlock.



4
5
6
7
8
9
10
11
# File 'lib/funktional/context/count_should_block.rb', line 4

def initialize(recorder, context)
  @recorder, @context = recorder, context
  @should_name = "count(#{@recorder.__target})"
  
  @blk = lambda do
    count(recorder.__target).send(recorder.__meth(0)[:name], *recorder.__meth(0)[:args])
  end
end

Instance Method Details

#test_name_partsObject



13
14
15
16
17
18
19
# File 'lib/funktional/context/count_should_block.rb', line 13

def test_name_parts
  parts = ["test:", "#{@context.full_name},", "#{@should_name}"]
  parts << @recorder.__meth(0)[:name].to_s.gsub('_', ' ')
  parts << "[#{@recorder.__meth(0)[:args]}]"
  
  return parts
end