Class: ObjcFeature
Instance Attribute Summary
Attributes inherited from Feature
#body, #follow_up_keyword, #given_scenario_keyword, #keyword, #parent, #parser, #scenario_keyword, #scenarios, #title
Instance Method Summary
collapse
Methods inherited from Feature
#initialize, #story, #story_html
Constructor Details
This class inherits a constructor from Feature
Instance Method Details
#parse_scenarios(klass = ObjcScenario) ⇒ Object
2
3
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/ObjC/objc_feature.rb', line 2
def parse_scenarios(klass=ObjcScenario)
title_body_arr = Parser.title_and_body_by_keyword_from_string({
:string => body,
:keyword => scenario_keyword
})
@scenarios = title_body_arr.map {|hash| klass.new(hash.update({
:parent => self,
:given_scenario_keyword => given_scenario_keyword,
:follow_up_keyword => follow_up_keyword
}))}
@scenarios.each {|scenario| scenario.collect_steps}
self
end
|
#test_case_name ⇒ Object
38
39
40
|
# File 'lib/ObjC/objc_feature.rb', line 38
def test_case_name
"#{title.remove_invalid_chars.split(/\s+/).map {|w| w.capitalize}.join('')}Test"
end
|
#to_html ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/ObjC/objc_feature.rb', line 26
def to_html
<<-END
<div class="feature">
<h2 class="feature_title">#{keyword} #{title}</h2>
<p class="story">
#{story_html}
</p>
#{scenarios.map {|s| s.to_html }.join(" \n")}
</div>
END
end
|
#to_s ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/ObjC/objc_feature.rb', line 16
def to_s
<<-END
@interface #{test_case_name} : OMFeature
@end
@implementation #{test_case_name}
#{scenarios.map {|s| s.to_s}.join(" ")}
@end
END
end
|