Class: Funktional::ElementShouldBlock

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

Instance Method Summary collapse

Methods inherited from ShouldBlock

build, #to_test

Constructor Details

#initialize(recorder, context) ⇒ ElementShouldBlock

Returns a new instance of ElementShouldBlock.



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

def initialize(recorder, context)
  @recorder, @context = recorder, context
  @should_name = "element(#{@recorder.__target})"
  
  @blk = lambda do
    element(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
20
21
# File 'lib/funktional/context/element_should_block.rb', line 13

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