Method: Funktional::TestClassMethods#should

Defined in:
lib/funktional/test_class_methods.rb

#should(name, &blk) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/funktional/test_class_methods.rb', line 13

def should(name, &blk)
  if Funktional.current_context
    raise 'block required' unless block_given?
    Funktional.current_context.should(name, &blk)
  else
    context_name = self.name.gsub(/Test/, "")
    
    context = Funktional::Context.new(context_name, self) do
      raise 'block required' unless block_given?
      should(name, &blk)
    end
    context.build
  end
end