cucumber_analytics 1.4.2 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +7 -0
- data/README.rdoc +4 -0
- data/Rakefile +1 -1
- data/cucumber_analytics.gemspec +3 -1
- data/features/modeling/background_modeling.feature +27 -13
- data/features/modeling/background_output.feature +130 -0
- data/features/modeling/directory_modeling.feature +11 -6
- data/features/modeling/directory_output.feature +13 -0
- data/features/modeling/doc_string_modeling.feature +18 -11
- data/features/modeling/doc_string_output.feature +71 -0
- data/features/modeling/example_modeling.feature +30 -19
- data/features/modeling/example_output.feature +192 -0
- data/features/modeling/feature_file_modeling.feature +9 -4
- data/features/modeling/feature_file_output.feature +13 -0
- data/features/modeling/feature_modeling.feature +33 -20
- data/features/modeling/feature_output.feature +244 -0
- data/features/modeling/outline_modeling.feature +29 -16
- data/features/modeling/outline_output.feature +197 -0
- data/features/modeling/row_modeling.feature +9 -4
- data/features/modeling/row_output.feature +27 -0
- data/features/modeling/scenario_modeling.feature +27 -14
- data/features/modeling/scenario_output.feature +147 -0
- data/features/modeling/step_modeling.feature +13 -8
- data/features/modeling/step_output.feature +52 -0
- data/features/modeling/table_modeling.feature +9 -4
- data/features/modeling/table_output.feature +42 -0
- data/features/modeling/table_row_modeling.feature +9 -4
- data/features/modeling/table_row_output.feature +27 -0
- data/features/modeling/tag_modeling.feature +10 -5
- data/features/modeling/tag_output.feature +16 -0
- data/features/step_definitions/action_steps.rb +3 -0
- data/features/step_definitions/background_steps.rb +17 -4
- data/features/step_definitions/directory_steps.rb +11 -0
- data/features/step_definitions/doc_string_steps.rb +18 -15
- data/features/step_definitions/feature_file_steps.rb +12 -1
- data/features/step_definitions/feature_steps.rb +23 -6
- data/features/step_definitions/outline_steps.rb +70 -9
- data/features/step_definitions/step_steps.rb +9 -1
- data/features/step_definitions/table_steps.rb +35 -2
- data/features/step_definitions/tag_steps.rb +8 -0
- data/features/step_definitions/test_steps.rb +14 -3
- data/features/step_definitions/verification_steps.rb +9 -0
- data/features/support/env.rb +1 -0
- data/lib/cucumber_analytics/background.rb +12 -0
- data/lib/cucumber_analytics/directory.rb +5 -0
- data/lib/cucumber_analytics/doc_string.rb +22 -0
- data/lib/cucumber_analytics/example.rb +55 -0
- data/lib/cucumber_analytics/feature.rb +26 -0
- data/lib/cucumber_analytics/feature_element.rb +25 -1
- data/lib/cucumber_analytics/feature_file.rb +5 -0
- data/lib/cucumber_analytics/outline.rb +18 -0
- data/lib/cucumber_analytics/parsing.rb +3 -1
- data/lib/cucumber_analytics/row.rb +5 -0
- data/lib/cucumber_analytics/scenario.rb +13 -0
- data/lib/cucumber_analytics/step.rb +8 -0
- data/lib/cucumber_analytics/table.rb +21 -0
- data/lib/cucumber_analytics/table_row.rb +5 -0
- data/lib/cucumber_analytics/tag.rb +5 -0
- data/lib/cucumber_analytics/taggable.rb +4 -0
- data/lib/cucumber_analytics/test_element.rb +8 -0
- data/lib/cucumber_analytics/version.rb +1 -1
- data/spec/integration/background_integration_spec.rb +12 -0
- data/spec/integration/example_integration_spec.rb +21 -0
- data/spec/integration/feature_integration_spec.rb +29 -0
- data/spec/integration/outline_integration_spec.rb +22 -0
- data/spec/integration/scenario_integration_spec.rb +16 -0
- data/spec/integration/step_integration_spec.rb +20 -0
- data/spec/integration/table_integration_spec.rb +11 -0
- data/spec/unit/background_unit_spec.rb +28 -0
- data/spec/unit/directory_unit_spec.rb +12 -0
- data/spec/unit/doc_string_unit_spec.rb +43 -3
- data/spec/unit/example_unit_spec.rb +53 -0
- data/spec/unit/feature_element_unit_specs.rb +9 -2
- data/spec/unit/feature_file_unit_spec.rb +12 -0
- data/spec/unit/feature_unit_spec.rb +30 -0
- data/spec/unit/outline_unit_spec.rb +30 -0
- data/spec/unit/row_unit_spec.rb +19 -7
- data/spec/unit/scenario_unit_spec.rb +30 -0
- data/spec/unit/step_unit_spec.rb +25 -1
- data/spec/unit/table_row_unit_spec.rb +12 -0
- data/spec/unit/table_unit_spec.rb +25 -0
- data/spec/unit/tag_unit_spec.rb +12 -0
- metadata +165 -86
- checksums.yaml +0 -15
@@ -20,6 +20,19 @@ module CucumberAnalytics
|
|
20
20
|
build_scenario(parsed_scenario) if parsed_scenario
|
21
21
|
end
|
22
22
|
|
23
|
+
# Returns gherkin representation of the scenario.
|
24
|
+
def to_s
|
25
|
+
text = ''
|
26
|
+
|
27
|
+
text << tag_output_string + "\n" unless tags.empty?
|
28
|
+
text << "Scenario:#{name_output_string}"
|
29
|
+
text << "\n" + description_output_string unless description_text.empty?
|
30
|
+
text << "\n" unless steps.empty? || description_text.empty?
|
31
|
+
text << "\n" + steps_output_string unless steps.empty?
|
32
|
+
|
33
|
+
text
|
34
|
+
end
|
35
|
+
|
23
36
|
|
24
37
|
private
|
25
38
|
|
@@ -131,6 +131,14 @@ module CucumberAnalytics
|
|
131
131
|
@arguments = @base.scan(pattern).flatten
|
132
132
|
end
|
133
133
|
|
134
|
+
# Returns a gherkin representation of the step.
|
135
|
+
def to_s
|
136
|
+
text = "#{keyword} #{base}"
|
137
|
+
text << "\n" + block.to_s.split("\n").collect { |line| " #{line}" }.join("\n") if block
|
138
|
+
|
139
|
+
text
|
140
|
+
end
|
141
|
+
|
134
142
|
|
135
143
|
private
|
136
144
|
|
@@ -10,6 +10,8 @@ module CucumberAnalytics
|
|
10
10
|
|
11
11
|
|
12
12
|
# The contents of the table
|
13
|
+
#
|
14
|
+
# Deprecated
|
13
15
|
attr_accessor :contents
|
14
16
|
|
15
17
|
# The row elements that make up the table
|
@@ -27,6 +29,11 @@ module CucumberAnalytics
|
|
27
29
|
build_table(parsed_table) if parsed_table
|
28
30
|
end
|
29
31
|
|
32
|
+
# Returns a gherkin representation of the table.
|
33
|
+
def to_s
|
34
|
+
row_elements.empty? ? '' : row_elements.collect { |row| row_output_string(row) }.join("\n")
|
35
|
+
end
|
36
|
+
|
30
37
|
|
31
38
|
private
|
32
39
|
|
@@ -65,5 +72,19 @@ module CucumberAnalytics
|
|
65
72
|
end
|
66
73
|
end
|
67
74
|
|
75
|
+
def row_output_string(row)
|
76
|
+
row_text = '|'
|
77
|
+
|
78
|
+
row.cells.count.times do |count|
|
79
|
+
row_text << " #{row.cells[count].ljust(determine_buffer_size(count))} |"
|
80
|
+
end
|
81
|
+
|
82
|
+
row_text
|
83
|
+
end
|
84
|
+
|
85
|
+
def determine_buffer_size(index)
|
86
|
+
row_elements.collect { |row| row.cells[index].length }.max || 0
|
87
|
+
end
|
88
|
+
|
68
89
|
end
|
69
90
|
end
|
@@ -65,5 +65,13 @@ module CucumberAnalytics
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
+
def steps_output_string
|
69
|
+
steps.collect { |step| indented_step_text(step) }.join("\n")
|
70
|
+
end
|
71
|
+
|
72
|
+
def indented_step_text(step)
|
73
|
+
step.to_s.split("\n").collect { |line| " #{line}" }.join("\n")
|
74
|
+
end
|
75
|
+
|
68
76
|
end
|
69
77
|
end
|
@@ -57,4 +57,16 @@ describe 'Background, Integration' do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
end
|
60
|
+
|
61
|
+
context 'background output edge cases' do
|
62
|
+
|
63
|
+
it 'can output a background that has only steps' do
|
64
|
+
background = CucumberAnalytics::Background.new
|
65
|
+
background.steps = [CucumberAnalytics::Step.new]
|
66
|
+
|
67
|
+
expect { background.to_s }.to_not raise_error
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
60
72
|
end
|
@@ -70,4 +70,25 @@ describe 'Example, Integration' do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
end
|
73
|
+
|
74
|
+
context 'example output edge cases' do
|
75
|
+
|
76
|
+
before(:each) do
|
77
|
+
@example = CucumberAnalytics::Example.new
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'can output an example that has only a tag elements' do
|
81
|
+
@example.tag_elements = [CucumberAnalytics::Tag.new]
|
82
|
+
|
83
|
+
expect { @example.to_s }.to_not raise_error
|
84
|
+
end
|
85
|
+
|
86
|
+
#todo - remove once Hash rows are no longer supported
|
87
|
+
it 'can output an example that has only row elements' do
|
88
|
+
@example.row_elements = [CucumberAnalytics::Row.new]
|
89
|
+
|
90
|
+
expect { @example.to_s }.to_not raise_error
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
73
94
|
end
|
@@ -120,4 +120,33 @@ describe 'Feature, Integration' do
|
|
120
120
|
end
|
121
121
|
|
122
122
|
end
|
123
|
+
|
124
|
+
context 'feature output edge cases' do
|
125
|
+
|
126
|
+
it 'can output a feature that has only a tag elements' do
|
127
|
+
@feature.tag_elements = [CucumberAnalytics::Tag.new]
|
128
|
+
|
129
|
+
expect { @feature.to_s }.to_not raise_error
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'can output a feature that has only a background' do
|
133
|
+
@feature.background = [CucumberAnalytics::Background.new]
|
134
|
+
|
135
|
+
expect { @feature.to_s }.to_not raise_error
|
136
|
+
end
|
137
|
+
|
138
|
+
it 'can output a feature that has only scenarios' do
|
139
|
+
@feature.tests = [CucumberAnalytics::Scenario.new]
|
140
|
+
|
141
|
+
expect { @feature.to_s }.to_not raise_error
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'can output a feature that has only outlines' do
|
145
|
+
@feature.tests = [CucumberAnalytics::Outline.new]
|
146
|
+
|
147
|
+
expect { @feature.to_s }.to_not raise_error
|
148
|
+
end
|
149
|
+
|
150
|
+
end
|
151
|
+
|
123
152
|
end
|
@@ -66,5 +66,27 @@ describe 'Outline, Integration' do
|
|
66
66
|
test.should be_nil
|
67
67
|
end
|
68
68
|
|
69
|
+
context 'outline output edge cases' do
|
70
|
+
|
71
|
+
it 'can output an outline that has only a tag elements' do
|
72
|
+
@outline.tag_elements = [CucumberAnalytics::Tag.new]
|
73
|
+
|
74
|
+
expect { @outline.to_s }.to_not raise_error
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'can output an outline that has only steps' do
|
78
|
+
@outline.steps = [CucumberAnalytics::Step.new]
|
79
|
+
|
80
|
+
expect { @outline.to_s }.to_not raise_error
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'can output an outline that has only examples' do
|
84
|
+
@outline.examples = [CucumberAnalytics::Example.new]
|
85
|
+
|
86
|
+
expect { @outline.to_s }.to_not raise_error
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
69
91
|
end
|
70
92
|
end
|
@@ -60,5 +60,21 @@ describe 'Scenario, Integration' do
|
|
60
60
|
test.should be_nil
|
61
61
|
end
|
62
62
|
|
63
|
+
context 'scenario output edge cases' do
|
64
|
+
|
65
|
+
it 'can output a scenario that has only a tag elements' do
|
66
|
+
@scenario.tag_elements = [CucumberAnalytics::Tag.new]
|
67
|
+
|
68
|
+
expect { @scenario.to_s }.to_not raise_error
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'can output a scenario that has only steps' do
|
72
|
+
@scenario.steps = [CucumberAnalytics::Step.new]
|
73
|
+
|
74
|
+
expect { @scenario.to_s }.to_not raise_error
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
63
79
|
end
|
64
80
|
end
|
@@ -161,4 +161,24 @@ describe 'Step, Integration' do
|
|
161
161
|
end
|
162
162
|
|
163
163
|
end
|
164
|
+
|
165
|
+
context 'step output edge cases' do
|
166
|
+
|
167
|
+
before(:each) do
|
168
|
+
@step = CucumberAnalytics::Step.new
|
169
|
+
end
|
170
|
+
|
171
|
+
it 'can output a step that has only a table' do
|
172
|
+
@step.block = CucumberAnalytics::Table.new
|
173
|
+
|
174
|
+
expect { @step.to_s }.to_not raise_error
|
175
|
+
end
|
176
|
+
|
177
|
+
it 'can output a step that has only a doc string' do
|
178
|
+
@step.block = CucumberAnalytics::DocString.new
|
179
|
+
|
180
|
+
expect { @step.to_s }.to_not raise_error
|
181
|
+
end
|
182
|
+
|
183
|
+
end
|
164
184
|
end
|
@@ -72,4 +72,15 @@ describe 'Table, Integration' do
|
|
72
72
|
end
|
73
73
|
|
74
74
|
end
|
75
|
+
|
76
|
+
context 'table output edge cases' do
|
77
|
+
# todo - remove once #contents is no longer supported
|
78
|
+
it 'can output a table that only has row elements' do
|
79
|
+
table = CucumberAnalytics::Table.new
|
80
|
+
table.row_elements = [CucumberAnalytics::TableRow.new]
|
81
|
+
|
82
|
+
expect { table.to_s }.to_not raise_error
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
75
86
|
end
|
@@ -24,4 +24,32 @@ describe 'Background, Unit' do
|
|
24
24
|
@element.name.should == 'test background'
|
25
25
|
end
|
26
26
|
|
27
|
+
context 'background output edge cases' do
|
28
|
+
|
29
|
+
before(:each) do
|
30
|
+
@background = clazz.new
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'is a String' do
|
34
|
+
@background.to_s.should be_a(String)
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'can output an empty background' do
|
38
|
+
expect { @background.to_s }.to_not raise_error
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'can output a background that has only a name' do
|
42
|
+
@background.name = 'a name'
|
43
|
+
|
44
|
+
expect { @background.to_s }.to_not raise_error
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'can output a background that has only a description' do
|
48
|
+
@background.description_text = 'a description'
|
49
|
+
|
50
|
+
expect { @background.to_s }.to_not raise_error
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
27
55
|
end
|
@@ -87,5 +87,17 @@ describe 'Directory, Unit' do
|
|
87
87
|
@directory.contains.should =~ everything
|
88
88
|
end
|
89
89
|
|
90
|
+
context 'directory output edge cases' do
|
91
|
+
|
92
|
+
it 'is a String' do
|
93
|
+
@directory.to_s.should be_a(String)
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'can output an empty directory' do
|
97
|
+
expect { @directory.to_s }.to_not raise_error
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
90
102
|
end
|
91
103
|
|
@@ -17,6 +17,8 @@ describe 'DocString, Unit' do
|
|
17
17
|
expect { @element = clazz.new(source) }.to_not raise_error
|
18
18
|
|
19
19
|
# Sanity check in case instantiation failed in a non-explosive manner
|
20
|
+
@element.contents_text.should == "some doc string"
|
21
|
+
#todo Remove once Array contents is no longer supported
|
20
22
|
@element.contents.should == ["some doc string"]
|
21
23
|
end
|
22
24
|
|
@@ -39,22 +41,33 @@ describe 'DocString, Unit' do
|
|
39
41
|
@doc_string.content_type.should == nil
|
40
42
|
end
|
41
43
|
|
42
|
-
it 'has contents
|
44
|
+
it 'has contents' do
|
45
|
+
#todo Remove once Array contents is no longer supported
|
43
46
|
@doc_string.should respond_to(:contents)
|
47
|
+
@doc_string.should respond_to(:contents_text)
|
44
48
|
end
|
45
49
|
|
46
|
-
it 'can get and set its contents
|
50
|
+
it 'can get and set its contents' do
|
51
|
+
#todo Remove once Array contents is no longer supported
|
47
52
|
@doc_string.contents = :some_contents
|
48
53
|
@doc_string.contents.should == :some_contents
|
49
54
|
@doc_string.contents = :some_other_contents
|
50
55
|
@doc_string.contents.should == :some_other_contents
|
56
|
+
|
57
|
+
@doc_string.contents_text = :some_contents
|
58
|
+
@doc_string.contents_text.should == :some_contents
|
59
|
+
@doc_string.contents_text = :some_other_contents
|
60
|
+
@doc_string.contents_text.should == :some_other_contents
|
51
61
|
end
|
52
62
|
|
53
63
|
it 'starts with no contents' do
|
64
|
+
#todo Remove once Array contents is no longer supported
|
54
65
|
@doc_string.contents.should == []
|
66
|
+
@doc_string.contents_text.should == ''
|
55
67
|
end
|
56
68
|
|
57
|
-
|
69
|
+
#todo Remove once Array contents is no longer supported
|
70
|
+
it 'stores its contents as an array of strings - deprecated' do
|
58
71
|
source = "\"\"\"\nsome text\nsome more text\n\"\"\""
|
59
72
|
doc_string = CucumberAnalytics::DocString.new(source)
|
60
73
|
|
@@ -66,4 +79,31 @@ describe 'DocString, Unit' do
|
|
66
79
|
end
|
67
80
|
end
|
68
81
|
|
82
|
+
it 'stores its contents as a String' do
|
83
|
+
source = "\"\"\"\nsome text\nsome more text\n\"\"\""
|
84
|
+
doc_string = clazz.new(source)
|
85
|
+
|
86
|
+
contents = doc_string.contents_text
|
87
|
+
|
88
|
+
contents.is_a?(String).should be_true
|
89
|
+
end
|
90
|
+
|
91
|
+
context 'doc string output edge cases' do
|
92
|
+
|
93
|
+
it 'is a String' do
|
94
|
+
@doc_string.to_s.should be_a(String)
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'can output an empty doc string' do
|
98
|
+
expect { @doc_string.to_s }.to_not raise_error
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'can output a doc string that has only a content type' do
|
102
|
+
@doc_string.content_type = 'some type'
|
103
|
+
|
104
|
+
expect { @doc_string.to_s }.to_not raise_error
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
|
69
109
|
end
|
@@ -53,6 +53,7 @@ describe 'Example, Unit' do
|
|
53
53
|
@example.should respond_to(:rows)
|
54
54
|
end
|
55
55
|
|
56
|
+
#todo - remove once Hash rows are no longer supported
|
56
57
|
it 'can get and set its rows - #rows, #rows=' do
|
57
58
|
@example.rows = :some_rows
|
58
59
|
@example.rows.should == :some_rows
|
@@ -60,10 +61,12 @@ describe 'Example, Unit' do
|
|
60
61
|
@example.rows.should == :some_other_rows
|
61
62
|
end
|
62
63
|
|
64
|
+
#todo - remove once Hash rows are no longer supported
|
63
65
|
it 'starts with no rows' do
|
64
66
|
@example.rows.should == []
|
65
67
|
end
|
66
68
|
|
69
|
+
#todo - remove once Hash rows are no longer supported
|
67
70
|
it 'stores its rows as an nested array of hashes' do
|
68
71
|
source = "Examples:\n|param1|param2|\n|value1|value2|"
|
69
72
|
example = CucumberAnalytics::Example.new(source)
|
@@ -112,6 +115,7 @@ describe 'Example, Unit' do
|
|
112
115
|
new_row = {'param1' => 'value3', 'param2' => 'value4'}
|
113
116
|
example.add_row(new_row)
|
114
117
|
|
118
|
+
#todo - remove once Hash rows are no longer supported
|
115
119
|
example.rows.should == [{'param1' => 'value1', 'param2' => 'value2'}, {'param1' => 'value3', 'param2' => 'value4'}]
|
116
120
|
example.row_elements.collect { |row| row.cells }[1..example.row_elements.count].should == [['value1', 'value2'], ['value3', 'value4']]
|
117
121
|
end
|
@@ -123,6 +127,7 @@ describe 'Example, Unit' do
|
|
123
127
|
new_row = ['value3', 'value4']
|
124
128
|
example.add_row(new_row)
|
125
129
|
|
130
|
+
#todo - remove once Hash rows are no longer supported
|
126
131
|
example.rows.should == [{'param1' => 'value1', 'param2' => 'value2'}, {'param1' => 'value3', 'param2' => 'value4'}]
|
127
132
|
example.row_elements.collect { |row| row.cells }[1..example.row_elements.count].should == [['value1', 'value2'], ['value3', 'value4']]
|
128
133
|
end
|
@@ -142,6 +147,7 @@ describe 'Example, Unit' do
|
|
142
147
|
example.add_row(hash_row)
|
143
148
|
example.add_row(array_row)
|
144
149
|
|
150
|
+
#todo - remove once Hash rows are no longer supported
|
145
151
|
example.rows.should == [{'param1' => 'value1', 'param2' => 'value2'}, {'param1' => 'value3', 'param2' => 'value4'}, {'param1' => 'value5', 'param2' => 'value6'}]
|
146
152
|
example.row_elements.collect { |row| row.cells }[1..example.row_elements.count].should == [['value1', 'value2'], ['value3', 'value4'], ['value5', 'value6']]
|
147
153
|
end
|
@@ -160,6 +166,7 @@ describe 'Example, Unit' do
|
|
160
166
|
old_row = {'param1' => 'value3', 'param2' => 'value4'}
|
161
167
|
example.remove_row(old_row)
|
162
168
|
|
169
|
+
#todo - remove once Hash rows are no longer supported
|
163
170
|
example.rows.should == [{'param1' => 'value1', 'param2' => 'value2'}]
|
164
171
|
example.row_elements.collect { |row| row.cells }[1..example.row_elements.count].should == [['value1', 'value2']]
|
165
172
|
end
|
@@ -171,6 +178,7 @@ describe 'Example, Unit' do
|
|
171
178
|
old_row = ['value3', 'value4']
|
172
179
|
example.remove_row(old_row)
|
173
180
|
|
181
|
+
#todo - remove once Hash rows are no longer supported
|
174
182
|
example.rows.should == [{'param1' => 'value1', 'param2' => 'value2'}]
|
175
183
|
example.row_elements.collect { |row| row.cells }[1..example.row_elements.count].should == [['value1', 'value2']]
|
176
184
|
end
|
@@ -190,9 +198,54 @@ describe 'Example, Unit' do
|
|
190
198
|
example.remove_row(hash_row)
|
191
199
|
example.remove_row(array_row)
|
192
200
|
|
201
|
+
#todo - remove once Hash rows are no longer supported
|
193
202
|
example.rows.should == [{'param1' => 'value1', 'param2' => 'value2'}]
|
194
203
|
example.row_elements.collect { |row| row.cells }[1..example.row_elements.count].should == [['value1', 'value2']]
|
195
204
|
end
|
196
205
|
end
|
197
206
|
|
207
|
+
context 'example output edge cases' do
|
208
|
+
|
209
|
+
it 'is a String' do
|
210
|
+
@example.to_s.should be_a(String)
|
211
|
+
end
|
212
|
+
|
213
|
+
it 'can output an empty example' do
|
214
|
+
expect { @example.to_s }.to_not raise_error
|
215
|
+
end
|
216
|
+
|
217
|
+
it 'can output an example that has only a name' do
|
218
|
+
@example.name = 'a name'
|
219
|
+
|
220
|
+
expect { @example.to_s }.to_not raise_error
|
221
|
+
end
|
222
|
+
|
223
|
+
it 'can output an example that has only a description' do
|
224
|
+
@example.description_text = 'a description'
|
225
|
+
|
226
|
+
expect { @example.to_s }.to_not raise_error
|
227
|
+
end
|
228
|
+
|
229
|
+
it 'can output an example that has only a tags' do
|
230
|
+
@example.tags = ['a tag']
|
231
|
+
|
232
|
+
expect { @example.to_s }.to_not raise_error
|
233
|
+
end
|
234
|
+
|
235
|
+
#todo - remove once Hash rows are no longer supported
|
236
|
+
it 'can output an example that only has parameters' do
|
237
|
+
@example.parameters = ['param1']
|
238
|
+
|
239
|
+
expect { @example.to_s }.to_not raise_error
|
240
|
+
end
|
241
|
+
|
242
|
+
#todo - remove once Hash rows are no longer supported
|
243
|
+
it 'can output an example that only has rows' do
|
244
|
+
@example.rows = [{:param1 => 'row1'}]
|
245
|
+
|
246
|
+
expect { @example.to_s }.to_not raise_error
|
247
|
+
end
|
248
|
+
|
249
|
+
end
|
250
|
+
|
198
251
|
end
|