Class: ObjcScenario

Inherits:
Scenario show all
Defined in:
lib/ObjC/objc_scenario.rb

Instance Attribute Summary

Attributes inherited from Scenario

#body, #follow_up_keyword, #given_scenario_keyword, #lines, #parent, #passed, #steps, #title

Instance Method Summary collapse

Methods inherited from Scenario

#collect_steps, #expand_follow_ups_in_body, #expand_given_scenarios_in_body, #follow_up_line_exp, #given_scenario_line_exp, #has_follow_ups?, #has_given_scenarios?, #initialize, #keyword, #passed?, #to_html

Constructor Details

This class inherits a constructor from Scenario

Instance Method Details

#parse_linesObject



16
17
18
# File 'lib/ObjC/objc_scenario.rb', line 16

def parse_lines
  lines.map {|l| ObjcStep.new({:body => l}).aggregate!}
end

#test_nameObject



29
30
31
# File 'lib/ObjC/objc_scenario.rb', line 29

def test_name
  "test#{title.remove_invalid_chars.split(/\s+/).map {|w| w.capitalize}.join('')}"
end

#to_sObject



20
21
22
23
24
25
26
27
# File 'lib/ObjC/objc_scenario.rb', line 20

def to_s
  "  -(void) \#{test_name}\n  {\n      \#{steps.map {|s| s.to_s}.join(\" \")}\n  }\n  END\nend\n"

#verify_status(results = "") ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/ObjC/objc_scenario.rb', line 2

def verify_status(results="")
  test_case_name = parent.test_case_name
  #Test Case '-[SayHelloTest testWithABlankObject]' failed (0.001 seconds).
  results =~ /Test\sCase\s'-\[#{test_case_name}\s#{test_name}\]'\s(\w+)/
  match = $1
  if match =~ /failed/
    @passed = false
  elsif match =~ /passed/
    @passed = true
  else
    raise "Can't read results File"
  end
end