cucumber 0.3.11 → 0.3.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +101 -0
- data/Manifest.txt +14 -5
- data/config/hoe.rb +1 -2
- data/cucumber.yml +1 -0
- data/examples/i18n/ar/Rakefile +1 -1
- data/examples/i18n/ar/features/addition.feature +1 -0
- data/examples/i18n/bg/Rakefile +1 -1
- data/examples/i18n/bg/features/addition.feature +1 -0
- data/examples/i18n/bg/features/consecutive_calculations.feature +1 -0
- data/examples/i18n/bg/features/division.feature +1 -0
- data/examples/i18n/cat/Rakefile +1 -1
- data/examples/i18n/cat/features/suma.feature +1 -0
- data/examples/i18n/da/Rakefile +1 -1
- data/examples/i18n/da/features/summering.feature +1 -0
- data/examples/i18n/de/Rakefile +1 -1
- data/examples/i18n/de/features/addition.feature +1 -0
- data/examples/i18n/de/features/division.feature +1 -0
- data/examples/i18n/en-lol/features/stuffing.feature +1 -1
- data/examples/i18n/en/Rakefile +1 -1
- data/examples/i18n/en/features/addition.feature +1 -0
- data/examples/i18n/en/features/division.feature +1 -0
- data/examples/i18n/es/Rakefile +1 -1
- data/examples/i18n/es/features/adicion.feature +1 -0
- data/examples/i18n/et/Rakefile +1 -1
- data/examples/i18n/et/features/jagamine.feature +1 -0
- data/examples/i18n/et/features/liitmine.feature +1 -0
- data/examples/i18n/fi/Rakefile +1 -1
- data/examples/i18n/fi/features/jakolasku.feature +1 -0
- data/examples/i18n/fr/Rakefile +1 -1
- data/examples/i18n/fr/features/addition.feature +2 -1
- data/examples/i18n/he/Rakefile +1 -1
- data/examples/i18n/he/features/addition.feature +1 -0
- data/examples/i18n/he/features/division.feature +1 -0
- data/examples/i18n/hu/Rakefile +1 -1
- data/examples/i18n/hu/features/addition.feature +1 -0
- data/examples/i18n/hu/features/division.feature +1 -0
- data/examples/i18n/id/Rakefile +1 -1
- data/examples/i18n/id/features/addition.feature +1 -0
- data/examples/i18n/id/features/division.feature +1 -0
- data/examples/i18n/it/Rakefile +1 -1
- data/examples/i18n/it/features/somma.feature +1 -0
- data/examples/i18n/ja/Rakefile +1 -1
- data/examples/i18n/ja/features/addition.feature +1 -0
- data/examples/i18n/ja/features/division.feature +1 -0
- data/examples/i18n/ko/Rakefile +1 -1
- data/examples/i18n/ko/features/addition.feature +6 -5
- data/examples/i18n/ko/features/division.feature +1 -0
- data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/lt/Rakefile +1 -1
- data/examples/i18n/lt/features/addition.feature +1 -0
- data/examples/i18n/lt/features/division.feature +1 -0
- data/examples/i18n/lv/Rakefile +1 -1
- data/examples/i18n/lv/features/addition.feature +1 -0
- data/examples/i18n/lv/features/division.feature +1 -0
- data/examples/i18n/no/Rakefile +1 -1
- data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +1 -1
- data/examples/i18n/no/features/summering.feature +1 -0
- data/examples/i18n/pl/Rakefile +1 -1
- data/examples/i18n/pl/features/addition.feature +1 -0
- data/examples/i18n/pl/features/division.feature +1 -0
- data/examples/i18n/pt/Rakefile +1 -1
- data/examples/i18n/pt/features/adicao.feature +1 -0
- data/examples/i18n/ro/Rakefile +1 -1
- data/examples/i18n/ro/features/suma.feature +1 -0
- data/examples/i18n/ru/Rakefile +1 -1
- data/examples/i18n/ru/features/addition.feature +1 -0
- data/examples/i18n/ru/features/consecutive_calculations.feature +1 -0
- data/examples/i18n/ru/features/division.feature +1 -0
- data/examples/i18n/se/Rakefile +1 -1
- data/examples/i18n/se/features/summering.feature +1 -0
- data/examples/i18n/sk/Rakefile +1 -1
- data/examples/i18n/sk/features/addition.feature +1 -0
- data/examples/i18n/sk/features/division.feature +1 -0
- data/examples/i18n/zh-CN/features/addition.feature +1 -0
- data/examples/i18n/zh-TW/features/addition.feature +1 -0
- data/examples/i18n/zh-TW/features/division.feature +1 -0
- data/examples/self_test/features/support/env.rb +2 -1
- data/examples/sinatra/features/step_definitions/add_steps.rb +1 -1
- data/examples/sinatra/features/support/env.rb +13 -5
- data/examples/steps_library/features/step_definitions/steps_lib1.rb +8 -0
- data/examples/steps_library/features/step_definitions/steps_lib2.rb +8 -0
- data/examples/tickets/features/step_definitons/tickets_steps.rb +15 -0
- data/examples/tickets/features/table_diffing.feature +13 -0
- data/features/after_block_exceptions.feature +4 -1
- data/features/after_step_block_exceptions.feature +4 -1
- data/features/background.feature +6 -0
- data/features/bug_371.feature +32 -0
- data/features/cucumber_cli.feature +11 -1
- data/features/cucumber_cli_diff_disabled.feature +9 -2
- data/features/drb_server_integration.feature +28 -5
- data/features/expand.feature +2 -1
- data/features/html_formatter/a.html +129 -1614
- data/features/junit_formatter.feature +4 -4
- data/features/language_from_header.feature +30 -0
- data/features/rake_task.feature +28 -0
- data/features/step_definitions/cucumber_steps.rb +2 -2
- data/features/steps_formatter.feature +25 -0
- data/features/support/env.rb +13 -5
- data/features/table_diffing.feature +45 -0
- data/features/unicode_table.feature +35 -0
- data/features/work_in_progress.feature +3 -0
- data/gem_tasks/sass.rake +4 -0
- data/lib/cucumber.rb +0 -57
- data/lib/cucumber/ast/comment.rb +1 -1
- data/lib/cucumber/ast/feature.rb +2 -2
- data/lib/cucumber/ast/feature_element.rb +4 -0
- data/lib/cucumber/ast/outline_table.rb +2 -1
- data/lib/cucumber/ast/py_string.rb +0 -1
- data/lib/cucumber/ast/scenario.rb +5 -3
- data/lib/cucumber/ast/scenario_outline.rb +6 -1
- data/lib/cucumber/ast/step.rb +8 -1
- data/lib/cucumber/ast/step_invocation.rb +6 -1
- data/lib/cucumber/ast/table.rb +287 -49
- data/lib/cucumber/ast/visitor.rb +2 -1
- data/lib/cucumber/cli/configuration.rb +45 -28
- data/lib/cucumber/cli/drb_client.rb +8 -9
- data/lib/cucumber/cli/language_help_formatter.rb +9 -7
- data/lib/cucumber/cli/main.rb +8 -9
- data/lib/cucumber/feature_file.rb +53 -0
- data/lib/cucumber/filter.rb +50 -0
- data/lib/cucumber/formatter/console.rb +12 -0
- data/lib/cucumber/formatter/cucumber.css +106 -48
- data/lib/cucumber/formatter/cucumber.sass +121 -31
- data/lib/cucumber/formatter/html.rb +6 -5
- data/lib/cucumber/formatter/junit.rb +3 -6
- data/lib/cucumber/formatter/pretty.rb +22 -9
- data/lib/cucumber/formatter/profile.rb +1 -1
- data/lib/cucumber/formatter/progress.rb +1 -1
- data/lib/cucumber/formatter/steps.rb +49 -0
- data/lib/cucumber/languages.yml +3 -3
- data/lib/cucumber/parser.rb +1 -33
- data/lib/cucumber/parser/feature.rb +39 -16
- data/lib/cucumber/parser/feature.tt +1 -3
- data/lib/cucumber/parser/i18n.tt +30 -23
- data/lib/cucumber/parser/i18n/language.rb +83 -0
- data/lib/cucumber/parser/treetop_ext.rb +12 -83
- data/lib/cucumber/platform.rb +6 -0
- data/lib/cucumber/rake/task.rb +6 -0
- data/lib/cucumber/step_definition.rb +6 -0
- data/lib/cucumber/step_match.rb +1 -1
- data/lib/cucumber/step_mother.rb +3 -3
- data/lib/cucumber/version.rb +1 -1
- data/lib/cucumber/webrat/table_locator.rb +66 -0
- data/rails_generators/cucumber/templates/cucumber.rake +4 -0
- data/rails_generators/cucumber/templates/env.rb +1 -0
- data/rails_generators/cucumber/templates/spork_env.rb +1 -1
- data/rails_generators/cucumber/templates/webrat_steps.rb +17 -0
- data/rails_generators/feature/templates/feature.erb +1 -1
- data/rails_generators/feature/templates/steps.erb +2 -8
- data/spec/cucumber/ast/step_collection_spec.rb +5 -4
- data/spec/cucumber/ast/table_spec.rb +145 -0
- data/spec/cucumber/cli/configuration_spec.rb +55 -9
- data/spec/cucumber/cli/drb_client_spec.rb +5 -4
- data/spec/cucumber/cli/main_spec.rb +9 -12
- data/spec/cucumber/formatter/progress_spec.rb +2 -2
- data/spec/cucumber/parser/feature_parser_spec.rb +11 -9
- data/spec/cucumber/parser/table_parser_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -1
- metadata +21 -20
- data/spec/cucumber/formatter/html/cucumber.css +0 -37
- data/spec/cucumber/formatter/html/cucumber.js +0 -13
- data/spec/cucumber/formatter/html/index.html +0 -45
- data/spec/cucumber/formatter/html/jquery-1.3.min.js +0 -19
- data/spec/cucumber/formatter/html/jquery.uitableedit.js +0 -100
|
@@ -98,6 +98,15 @@ Then /^I should see "([^\"]*)"$/ do |text|
|
|
|
98
98
|
<% end -%>
|
|
99
99
|
end
|
|
100
100
|
|
|
101
|
+
Then /^I should see \/([^\/]*)\/$/ do |regexp|
|
|
102
|
+
regexp = Regexp.new(regexp)
|
|
103
|
+
<% if framework == :rspec -%>
|
|
104
|
+
response.should contain(regexp)
|
|
105
|
+
<% else -%>
|
|
106
|
+
assert_contain regexp
|
|
107
|
+
<% end -%>
|
|
108
|
+
end
|
|
109
|
+
|
|
101
110
|
Then /^I should not see "([^\"]*)"$/ do |text|
|
|
102
111
|
<% if framework == :rspec -%>
|
|
103
112
|
response.should_not contain(text)
|
|
@@ -106,6 +115,14 @@ Then /^I should not see "([^\"]*)"$/ do |text|
|
|
|
106
115
|
<% end -%>
|
|
107
116
|
end
|
|
108
117
|
|
|
118
|
+
Then /^I should not see \/([^\/]*)\/$/ do |regexp|
|
|
119
|
+
<% if framework == :rspec -%>
|
|
120
|
+
response.should_not contain(text)
|
|
121
|
+
<% else -%>
|
|
122
|
+
assert_not_contain text
|
|
123
|
+
<% end -%>
|
|
124
|
+
end
|
|
125
|
+
|
|
109
126
|
Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
|
|
110
127
|
<% if framework == :rspec -%>
|
|
111
128
|
field_labeled(field).value.should =~ /#{value}/
|
|
@@ -25,7 +25,7 @@ Feature: Manage <%= plural_name %>
|
|
|
25
25
|
<% end -%>
|
|
26
26
|
When I delete the 3rd <%= singular_name %>
|
|
27
27
|
Then I should see the following <%= plural_name %>:
|
|
28
|
-
|<%= named_args.map
|
|
28
|
+
|<%= named_args.map{|arg| arg.name.humanize}.join('|') %>|
|
|
29
29
|
<% [1,2,4].each do |n| -%>
|
|
30
30
|
|<%= named_args.map{|arg| arg.value(n)}.join('|') %>|
|
|
31
31
|
<% end -%>
|
|
@@ -9,12 +9,6 @@ When /^I delete the (\d+)(?:st|nd|rd|th) <%= singular_name %>$/ do |pos|
|
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
Then /^I should see the following <%= plural_name %>:$/ do
|
|
13
|
-
<%= plural_name
|
|
14
|
-
row.each_with_index do |cell, j|
|
|
15
|
-
response.should have_selector("table > tr:nth-child(#{i+2}) > td:nth-child(#{j+1})") { |td|
|
|
16
|
-
td.inner_text.should == cell
|
|
17
|
-
}
|
|
18
|
-
end
|
|
19
|
-
end
|
|
12
|
+
Then /^I should see the following <%= plural_name %>:$/ do |expected_<%= plural_name %>_table|
|
|
13
|
+
expected_<%= plural_name %>_table.diff!(table_at('table').to_a)
|
|
20
14
|
end
|
|
@@ -4,10 +4,11 @@ module Cucumber
|
|
|
4
4
|
module Ast
|
|
5
5
|
describe StepCollection do
|
|
6
6
|
it "should convert And to Given in snippets" do
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
])
|
|
7
|
+
s1 = Step.new(1, 'Given', 'cukes')
|
|
8
|
+
s2 = Step.new(2, 'And', 'turnips')
|
|
9
|
+
s1.stub!(:language).and_return(Parser::I18n::Language['en'])
|
|
10
|
+
s2.stub!(:language).and_return(Parser::I18n::Language['en'])
|
|
11
|
+
c = StepCollection.new([s1, s2])
|
|
11
12
|
actual_keywords = c.step_invocations.map{|i| i.actual_keyword}
|
|
12
13
|
actual_keywords.should == %w{Given Given}
|
|
13
14
|
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
1
2
|
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
3
|
require 'cucumber/ast/table'
|
|
3
4
|
|
|
@@ -168,6 +169,150 @@ module Cucumber
|
|
|
168
169
|
|
|
169
170
|
end
|
|
170
171
|
|
|
172
|
+
describe "diff!" do
|
|
173
|
+
it "should detect a complex diff" do
|
|
174
|
+
t1 = table(%{
|
|
175
|
+
| 1 | 22 | 333 | 4444 |
|
|
176
|
+
| 55555 | 666666 | 7777777 | 88888888 |
|
|
177
|
+
| 999999999 | 0000000000 | 01010101010 | 121212121212 |
|
|
178
|
+
| 4000 | ABC | DEF | 50000 |
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
t2 = table(%{
|
|
182
|
+
| a | 4444 | 1 |
|
|
183
|
+
| bb | 88888888 | 55555 |
|
|
184
|
+
| ccc | xxxxxxxx | 999999999 |
|
|
185
|
+
| dddd | 4000 | 300 |
|
|
186
|
+
| e | 50000 | 4000 |
|
|
187
|
+
})
|
|
188
|
+
lambda{t1.diff!(t2)}.should raise_error
|
|
189
|
+
t1.to_s(:indent => 12, :color => false).should == %{
|
|
190
|
+
| 1 | (-) 22 | (-) 333 | 4444 | (+) a |
|
|
191
|
+
| 55555 | (-) 666666 | (-) 7777777 | 88888888 | (+) bb |
|
|
192
|
+
| (-) 999999999 | (-) 0000000000 | (-) 01010101010 | (-) 121212121212 | (+) |
|
|
193
|
+
| (+) 999999999 | (+) | (+) | (+) xxxxxxxx | (+) ccc |
|
|
194
|
+
| (+) 300 | (+) | (+) | (+) 4000 | (+) dddd |
|
|
195
|
+
| 4000 | (-) ABC | (-) DEF | 50000 | (+) e |
|
|
196
|
+
}
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
it "should not change table when diffed with identical" do
|
|
200
|
+
t = table(%{
|
|
201
|
+
|a|b|c|
|
|
202
|
+
|d|e|f|
|
|
203
|
+
|g|h|i|
|
|
204
|
+
})
|
|
205
|
+
t.diff!(t.dup)
|
|
206
|
+
t.to_s(:indent => 12, :color => false).should == %{
|
|
207
|
+
| a | b | c |
|
|
208
|
+
| d | e | f |
|
|
209
|
+
| g | h | i |
|
|
210
|
+
}
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
it "should inspect missing and surplus cells" do
|
|
214
|
+
t1 = Table.new([
|
|
215
|
+
['name', 'male', 'lastname', 'swedish'],
|
|
216
|
+
['aslak', 'true', 'hellesøy', 'false']
|
|
217
|
+
])
|
|
218
|
+
t2 = Table.new([
|
|
219
|
+
['name', 'male', 'lastname', 'swedish'],
|
|
220
|
+
['aslak', true, 'hellesøy', false]
|
|
221
|
+
])
|
|
222
|
+
lambda{t1.diff!(t2)}.should raise_error
|
|
223
|
+
t1.to_s(:indent => 12, :color => false).should == %{
|
|
224
|
+
| name | male | lastname | swedish |
|
|
225
|
+
| (-) aslak | (-) (i) "true" | (-) hellesøy | (-) (i) "false" |
|
|
226
|
+
| (+) aslak | (+) (i) true | (+) hellesøy | (+) (i) false |
|
|
227
|
+
}
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
it "should allow column mapping before diffing" do
|
|
231
|
+
t1 = Table.new([
|
|
232
|
+
['name', 'male'],
|
|
233
|
+
['aslak', 'true']
|
|
234
|
+
])
|
|
235
|
+
t1.map_column!('male') { |m| m == 'true' }
|
|
236
|
+
t2 = Table.new([
|
|
237
|
+
['name', 'male'],
|
|
238
|
+
['aslak', true]
|
|
239
|
+
])
|
|
240
|
+
t1.diff!(t2)
|
|
241
|
+
t1.to_s(:indent => 12, :color => false).should == %{
|
|
242
|
+
| name | male |
|
|
243
|
+
| aslak | true |
|
|
244
|
+
}
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
it "should allow header mapping before diffing" do
|
|
248
|
+
t1 = Table.new([
|
|
249
|
+
['Name', 'Male'],
|
|
250
|
+
['aslak', 'true']
|
|
251
|
+
])
|
|
252
|
+
t1.map_headers!('Name' => 'name', 'Male' => 'male')
|
|
253
|
+
t1.map_column!('male') { |m| m == 'true' }
|
|
254
|
+
t2 = Table.new([
|
|
255
|
+
['name', 'male'],
|
|
256
|
+
['aslak', true]
|
|
257
|
+
])
|
|
258
|
+
t1.diff!(t2)
|
|
259
|
+
t1.to_s(:indent => 12, :color => false).should == %{
|
|
260
|
+
| name | male |
|
|
261
|
+
| aslak | true |
|
|
262
|
+
}
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
describe "raising" do
|
|
266
|
+
before do
|
|
267
|
+
@t = table(%{
|
|
268
|
+
| a | b |
|
|
269
|
+
| c | d |
|
|
270
|
+
})
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
it "should raise on missing rows" do
|
|
274
|
+
t = table(%{
|
|
275
|
+
| a | b |
|
|
276
|
+
})
|
|
277
|
+
lambda { @t.dup.diff!(t) }.should raise_error
|
|
278
|
+
lambda { @t.dup.diff!(t, :missing_row => false) }.should_not raise_error
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
it "should raise on surplus rows" do
|
|
282
|
+
t = table(%{
|
|
283
|
+
| a | b |
|
|
284
|
+
| c | d |
|
|
285
|
+
| e | f |
|
|
286
|
+
})
|
|
287
|
+
lambda { @t.dup.diff!(t) }.should raise_error
|
|
288
|
+
lambda { @t.dup.diff!(t, :surplus_row => false) }.should_not raise_error
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
it "should raise on missing columns" do
|
|
292
|
+
t = table(%{
|
|
293
|
+
| a |
|
|
294
|
+
| c |
|
|
295
|
+
})
|
|
296
|
+
lambda { @t.dup.diff!(t) }.should raise_error
|
|
297
|
+
lambda { @t.dup.diff!(t, :missing_col => false) }.should_not raise_error
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
it "should not raise on surplus columns" do
|
|
301
|
+
t = table(%{
|
|
302
|
+
| a | b | x |
|
|
303
|
+
| c | d | y |
|
|
304
|
+
})
|
|
305
|
+
lambda { @t.dup.diff!(t) }.should_not raise_error
|
|
306
|
+
lambda { @t.dup.diff!(t, :surplus_col => true) }.should raise_error
|
|
307
|
+
end
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
def table(text, file=nil, line_offset=0)
|
|
311
|
+
@table_parser ||= Parser::TableParser.new
|
|
312
|
+
@table_parser.parse_or_fail(text.strip, file, line_offset)
|
|
313
|
+
end
|
|
314
|
+
end
|
|
315
|
+
|
|
171
316
|
it "should convert to sexp" do
|
|
172
317
|
@table.to_sexp.should ==
|
|
173
318
|
[:table,
|
|
@@ -55,6 +55,19 @@ module Cli
|
|
|
55
55
|
]
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
+
it "should require files in vendor/{plugins,gems}/*/cucumber/*.rb" do
|
|
59
|
+
given_the_following_files("/vendor/plugins/plugin_a/cucumber/foo.rb",
|
|
60
|
+
"/vendor/gems/gem_a/cucumber/bar.rb")
|
|
61
|
+
|
|
62
|
+
config = Configuration.new(StringIO.new)
|
|
63
|
+
config.parse!(%w{--require /features})
|
|
64
|
+
|
|
65
|
+
config.files_to_require.should == [
|
|
66
|
+
"/vendor/plugins/plugin_a/cucumber/foo.rb",
|
|
67
|
+
"/vendor/gems/gem_a/cucumber/bar.rb"
|
|
68
|
+
]
|
|
69
|
+
end
|
|
70
|
+
|
|
58
71
|
describe "--exclude" do
|
|
59
72
|
|
|
60
73
|
it "excludes a ruby file from requiring when the name matches exactly" do
|
|
@@ -138,12 +151,22 @@ module Cli
|
|
|
138
151
|
|
|
139
152
|
end
|
|
140
153
|
|
|
154
|
+
context '--drb in the default profile and no arguments specified' do
|
|
155
|
+
it "expands the profile's arguments into the args excpet for --drb" do
|
|
156
|
+
given_cucumber_yml_defined_as({'default' => '--drb features --format pretty'})
|
|
157
|
+
config = Configuration.new(StringIO.new)
|
|
158
|
+
args = []
|
|
159
|
+
config.parse!(args)
|
|
160
|
+
args.should == %w{features --format pretty}
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
141
164
|
it "should expand args from YAML file" do
|
|
142
165
|
given_cucumber_yml_defined_as({'bongo' => '--require from/yml'})
|
|
143
166
|
|
|
144
167
|
config = Configuration.new
|
|
145
168
|
config.parse!(%w{--format progress --profile bongo})
|
|
146
|
-
config.options[:formats].should ==
|
|
169
|
+
config.options[:formats].should == [['progress', STDOUT]]
|
|
147
170
|
config.options[:require].should == ['from/yml']
|
|
148
171
|
end
|
|
149
172
|
|
|
@@ -255,26 +278,34 @@ END_OF_MESSAGE
|
|
|
255
278
|
it "should accept --out option" do
|
|
256
279
|
config = Configuration.new(StringIO.new)
|
|
257
280
|
config.parse!(%w{--out jalla.txt})
|
|
258
|
-
config.options[:formats]
|
|
281
|
+
config.options[:formats].should == [['pretty', 'jalla.txt']]
|
|
259
282
|
end
|
|
260
283
|
|
|
261
284
|
it "should accept multiple --out options" do
|
|
262
285
|
config = Configuration.new(StringIO.new)
|
|
263
286
|
config.parse!(%w{--format progress --out file1 --out file2})
|
|
264
|
-
config.options[:formats].should ==
|
|
287
|
+
config.options[:formats].should == [['progress', 'file2']]
|
|
265
288
|
end
|
|
266
289
|
|
|
267
|
-
it "should accept multiple --format options" do
|
|
268
|
-
|
|
269
|
-
config.
|
|
270
|
-
config.
|
|
271
|
-
config.options[:formats].should
|
|
290
|
+
it "should accept multiple --format options and put the STDOUT one first so progress is seen" do
|
|
291
|
+
io = StringIO.new
|
|
292
|
+
config = Configuration.new(io)
|
|
293
|
+
config.parse!(%w{--format pretty --out pretty.txt --format progress})
|
|
294
|
+
config.options[:formats].should == [['progress', io], ['pretty', 'pretty.txt']]
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
it "should not accept multiple --format options when both use implicit STDOUT" do
|
|
298
|
+
io = StringIO.new
|
|
299
|
+
config = Configuration.new(io)
|
|
300
|
+
lambda do
|
|
301
|
+
config.parse!(%w{--format pretty --format progress})
|
|
302
|
+
end.should raise_error("All but one formatter must use --out, only one can print to STDOUT")
|
|
272
303
|
end
|
|
273
304
|
|
|
274
305
|
it "should associate --out to previous --format" do
|
|
275
306
|
config = Configuration.new(StringIO.new)
|
|
276
307
|
config.parse!(%w{--format progress --out file1 --format profile --out file2})
|
|
277
|
-
config.options[:formats].should ==
|
|
308
|
+
config.options[:formats].should == [["progress", "file1"], ["profile" ,"file2"]]
|
|
278
309
|
end
|
|
279
310
|
|
|
280
311
|
it "should accept --color option" do
|
|
@@ -358,6 +389,21 @@ END_OF_MESSAGE
|
|
|
358
389
|
config.feature_files.should == ["cucumber.feature"]
|
|
359
390
|
end
|
|
360
391
|
|
|
392
|
+
it "should allow specifying environment variables on the command line" do
|
|
393
|
+
config = Configuration.new
|
|
394
|
+
config.parse!(["foo=bar"])
|
|
395
|
+
ENV["foo"].should == "bar"
|
|
396
|
+
config.feature_files.should == []
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
it "should allow specifying environment variables in profiles" do
|
|
400
|
+
given_cucumber_yml_defined_as({'selenium' => 'RAILS_ENV=selenium'})
|
|
401
|
+
config = Configuration.new
|
|
402
|
+
config.parse!(["--profile", "selenium"])
|
|
403
|
+
ENV["RAILS_ENV"].should == "selenium"
|
|
404
|
+
config.feature_files.should == []
|
|
405
|
+
end
|
|
406
|
+
|
|
361
407
|
end
|
|
362
408
|
end
|
|
363
409
|
end
|
|
@@ -28,13 +28,14 @@ module Cucumber
|
|
|
28
28
|
DRbClient.run(@args, @error_stream, @out_stream)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
it "returns
|
|
31
|
+
it "returns raises an error when it can't connect to the server" do
|
|
32
32
|
DRbObject.stub!(:new_with_uri).and_raise(DRb::DRbConnError)
|
|
33
|
-
DRbClient.run(@args, @error_stream, @out_stream).should
|
|
33
|
+
running { DRbClient.run(@args, @error_stream, @out_stream) }.should raise_error(DRbClientError, "No DRb server is running.")
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
it "returns
|
|
37
|
-
|
|
36
|
+
it "returns the result from the DRb server call" do
|
|
37
|
+
@drb_object.should_receive(:run).and_return('foo')
|
|
38
|
+
DRbClient.run(@args, @error_stream, @out_stream).should == 'foo'
|
|
38
39
|
end
|
|
39
40
|
|
|
40
41
|
end
|
|
@@ -19,7 +19,6 @@ module Cucumber
|
|
|
19
19
|
|
|
20
20
|
before(:each) do
|
|
21
21
|
@empty_feature = Ast::Feature.new(nil, Ast::Comment.new(''), Ast::Tags.new(2, []), "Feature", [])
|
|
22
|
-
Dir.stub!(:[])
|
|
23
22
|
end
|
|
24
23
|
|
|
25
24
|
it "should show ruby files required" do
|
|
@@ -35,7 +34,7 @@ module Cucumber
|
|
|
35
34
|
@cli = Main.new(%w{--verbose example.feature}, @out)
|
|
36
35
|
@cli.stub!(:require)
|
|
37
36
|
|
|
38
|
-
|
|
37
|
+
FeatureFile.stub!(:new).and_return(mock("feature file", :parse => @empty_feature))
|
|
39
38
|
|
|
40
39
|
@cli.execute!(Object.new.extend(StepMother))
|
|
41
40
|
|
|
@@ -110,33 +109,31 @@ module Cucumber
|
|
|
110
109
|
@cli.execute!(@step_mother)
|
|
111
110
|
end
|
|
112
111
|
|
|
112
|
+
it "returns the result from the DRbClient" do
|
|
113
|
+
DRbClient.stub!(:run).and_return('foo')
|
|
114
|
+
@cli.execute!(@step_mother).should == 'foo'
|
|
115
|
+
end
|
|
116
|
+
|
|
113
117
|
it "ceases execution if the DrbClient is able to perform the execution" do
|
|
114
118
|
DRbClient.stub!(:run).and_return(true)
|
|
115
|
-
@configuration.should_not_receive(:
|
|
119
|
+
@configuration.should_not_receive(:build_formatter_broadcaster)
|
|
116
120
|
@cli.execute!(@step_mother)
|
|
117
121
|
end
|
|
118
122
|
|
|
119
123
|
context "when the DrbClient is unable to perfrom the execution" do
|
|
120
|
-
before { DRbClient.stub!(:run).
|
|
124
|
+
before { DRbClient.stub!(:run).and_raise(DRbClientError.new('error message.')) }
|
|
121
125
|
|
|
122
126
|
it "alerts the user that execution will be performed locally" do
|
|
123
127
|
@cli.execute!(@step_mother)
|
|
124
|
-
@err.string.should include("WARNING:
|
|
128
|
+
@err.string.should include("WARNING: error message. Running features locally:")
|
|
125
129
|
end
|
|
126
130
|
|
|
127
131
|
it "reparses the configuration since the --drb flag causes the initial parsing to short circuit" do
|
|
128
132
|
@configuration.should_receive(:parse!).exactly(:twice)
|
|
129
133
|
@cli.execute!(@step_mother)
|
|
130
134
|
end
|
|
131
|
-
|
|
132
|
-
it "proceeds with the execution locally" do
|
|
133
|
-
@configuration.should_receive(:load_language)
|
|
134
|
-
@cli.execute!(@step_mother)
|
|
135
|
-
end
|
|
136
135
|
end
|
|
137
|
-
|
|
138
136
|
end
|
|
139
|
-
|
|
140
137
|
end
|
|
141
138
|
end
|
|
142
139
|
end
|
|
@@ -17,7 +17,7 @@ module Cucumber
|
|
|
17
17
|
describe "visiting a table cell value without a status" do
|
|
18
18
|
it "should take the status from the last run step" do
|
|
19
19
|
@progress.visit_step_result('', '', nil, :failed, nil, 10, nil)
|
|
20
|
-
@progress.visit_table_cell_value('value',
|
|
20
|
+
@progress.visit_table_cell_value('value', nil)
|
|
21
21
|
|
|
22
22
|
@out.string.should == "FF"
|
|
23
23
|
end
|
|
@@ -25,7 +25,7 @@ module Cucumber
|
|
|
25
25
|
|
|
26
26
|
describe "visiting a table cell which is a table header" do
|
|
27
27
|
it "should not output anything" do
|
|
28
|
-
@progress.visit_table_cell_value('value',
|
|
28
|
+
@progress.visit_table_cell_value('value', :skipped_param)
|
|
29
29
|
|
|
30
30
|
@out.string.should == ""
|
|
31
31
|
end
|