cucumber 0.3.11 → 0.3.90

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. data/History.txt +101 -0
  2. data/Manifest.txt +14 -5
  3. data/config/hoe.rb +1 -2
  4. data/cucumber.yml +1 -0
  5. data/examples/i18n/ar/Rakefile +1 -1
  6. data/examples/i18n/ar/features/addition.feature +1 -0
  7. data/examples/i18n/bg/Rakefile +1 -1
  8. data/examples/i18n/bg/features/addition.feature +1 -0
  9. data/examples/i18n/bg/features/consecutive_calculations.feature +1 -0
  10. data/examples/i18n/bg/features/division.feature +1 -0
  11. data/examples/i18n/cat/Rakefile +1 -1
  12. data/examples/i18n/cat/features/suma.feature +1 -0
  13. data/examples/i18n/da/Rakefile +1 -1
  14. data/examples/i18n/da/features/summering.feature +1 -0
  15. data/examples/i18n/de/Rakefile +1 -1
  16. data/examples/i18n/de/features/addition.feature +1 -0
  17. data/examples/i18n/de/features/division.feature +1 -0
  18. data/examples/i18n/en-lol/features/stuffing.feature +1 -1
  19. data/examples/i18n/en/Rakefile +1 -1
  20. data/examples/i18n/en/features/addition.feature +1 -0
  21. data/examples/i18n/en/features/division.feature +1 -0
  22. data/examples/i18n/es/Rakefile +1 -1
  23. data/examples/i18n/es/features/adicion.feature +1 -0
  24. data/examples/i18n/et/Rakefile +1 -1
  25. data/examples/i18n/et/features/jagamine.feature +1 -0
  26. data/examples/i18n/et/features/liitmine.feature +1 -0
  27. data/examples/i18n/fi/Rakefile +1 -1
  28. data/examples/i18n/fi/features/jakolasku.feature +1 -0
  29. data/examples/i18n/fr/Rakefile +1 -1
  30. data/examples/i18n/fr/features/addition.feature +2 -1
  31. data/examples/i18n/he/Rakefile +1 -1
  32. data/examples/i18n/he/features/addition.feature +1 -0
  33. data/examples/i18n/he/features/division.feature +1 -0
  34. data/examples/i18n/hu/Rakefile +1 -1
  35. data/examples/i18n/hu/features/addition.feature +1 -0
  36. data/examples/i18n/hu/features/division.feature +1 -0
  37. data/examples/i18n/id/Rakefile +1 -1
  38. data/examples/i18n/id/features/addition.feature +1 -0
  39. data/examples/i18n/id/features/division.feature +1 -0
  40. data/examples/i18n/it/Rakefile +1 -1
  41. data/examples/i18n/it/features/somma.feature +1 -0
  42. data/examples/i18n/ja/Rakefile +1 -1
  43. data/examples/i18n/ja/features/addition.feature +1 -0
  44. data/examples/i18n/ja/features/division.feature +1 -0
  45. data/examples/i18n/ko/Rakefile +1 -1
  46. data/examples/i18n/ko/features/addition.feature +6 -5
  47. data/examples/i18n/ko/features/division.feature +1 -0
  48. data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +1 -1
  49. data/examples/i18n/lt/Rakefile +1 -1
  50. data/examples/i18n/lt/features/addition.feature +1 -0
  51. data/examples/i18n/lt/features/division.feature +1 -0
  52. data/examples/i18n/lv/Rakefile +1 -1
  53. data/examples/i18n/lv/features/addition.feature +1 -0
  54. data/examples/i18n/lv/features/division.feature +1 -0
  55. data/examples/i18n/no/Rakefile +1 -1
  56. data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +1 -1
  57. data/examples/i18n/no/features/summering.feature +1 -0
  58. data/examples/i18n/pl/Rakefile +1 -1
  59. data/examples/i18n/pl/features/addition.feature +1 -0
  60. data/examples/i18n/pl/features/division.feature +1 -0
  61. data/examples/i18n/pt/Rakefile +1 -1
  62. data/examples/i18n/pt/features/adicao.feature +1 -0
  63. data/examples/i18n/ro/Rakefile +1 -1
  64. data/examples/i18n/ro/features/suma.feature +1 -0
  65. data/examples/i18n/ru/Rakefile +1 -1
  66. data/examples/i18n/ru/features/addition.feature +1 -0
  67. data/examples/i18n/ru/features/consecutive_calculations.feature +1 -0
  68. data/examples/i18n/ru/features/division.feature +1 -0
  69. data/examples/i18n/se/Rakefile +1 -1
  70. data/examples/i18n/se/features/summering.feature +1 -0
  71. data/examples/i18n/sk/Rakefile +1 -1
  72. data/examples/i18n/sk/features/addition.feature +1 -0
  73. data/examples/i18n/sk/features/division.feature +1 -0
  74. data/examples/i18n/zh-CN/features/addition.feature +1 -0
  75. data/examples/i18n/zh-TW/features/addition.feature +1 -0
  76. data/examples/i18n/zh-TW/features/division.feature +1 -0
  77. data/examples/self_test/features/support/env.rb +2 -1
  78. data/examples/sinatra/features/step_definitions/add_steps.rb +1 -1
  79. data/examples/sinatra/features/support/env.rb +13 -5
  80. data/examples/steps_library/features/step_definitions/steps_lib1.rb +8 -0
  81. data/examples/steps_library/features/step_definitions/steps_lib2.rb +8 -0
  82. data/examples/tickets/features/step_definitons/tickets_steps.rb +15 -0
  83. data/examples/tickets/features/table_diffing.feature +13 -0
  84. data/features/after_block_exceptions.feature +4 -1
  85. data/features/after_step_block_exceptions.feature +4 -1
  86. data/features/background.feature +6 -0
  87. data/features/bug_371.feature +32 -0
  88. data/features/cucumber_cli.feature +11 -1
  89. data/features/cucumber_cli_diff_disabled.feature +9 -2
  90. data/features/drb_server_integration.feature +28 -5
  91. data/features/expand.feature +2 -1
  92. data/features/html_formatter/a.html +129 -1614
  93. data/features/junit_formatter.feature +4 -4
  94. data/features/language_from_header.feature +30 -0
  95. data/features/rake_task.feature +28 -0
  96. data/features/step_definitions/cucumber_steps.rb +2 -2
  97. data/features/steps_formatter.feature +25 -0
  98. data/features/support/env.rb +13 -5
  99. data/features/table_diffing.feature +45 -0
  100. data/features/unicode_table.feature +35 -0
  101. data/features/work_in_progress.feature +3 -0
  102. data/gem_tasks/sass.rake +4 -0
  103. data/lib/cucumber.rb +0 -57
  104. data/lib/cucumber/ast/comment.rb +1 -1
  105. data/lib/cucumber/ast/feature.rb +2 -2
  106. data/lib/cucumber/ast/feature_element.rb +4 -0
  107. data/lib/cucumber/ast/outline_table.rb +2 -1
  108. data/lib/cucumber/ast/py_string.rb +0 -1
  109. data/lib/cucumber/ast/scenario.rb +5 -3
  110. data/lib/cucumber/ast/scenario_outline.rb +6 -1
  111. data/lib/cucumber/ast/step.rb +8 -1
  112. data/lib/cucumber/ast/step_invocation.rb +6 -1
  113. data/lib/cucumber/ast/table.rb +287 -49
  114. data/lib/cucumber/ast/visitor.rb +2 -1
  115. data/lib/cucumber/cli/configuration.rb +45 -28
  116. data/lib/cucumber/cli/drb_client.rb +8 -9
  117. data/lib/cucumber/cli/language_help_formatter.rb +9 -7
  118. data/lib/cucumber/cli/main.rb +8 -9
  119. data/lib/cucumber/feature_file.rb +53 -0
  120. data/lib/cucumber/filter.rb +50 -0
  121. data/lib/cucumber/formatter/console.rb +12 -0
  122. data/lib/cucumber/formatter/cucumber.css +106 -48
  123. data/lib/cucumber/formatter/cucumber.sass +121 -31
  124. data/lib/cucumber/formatter/html.rb +6 -5
  125. data/lib/cucumber/formatter/junit.rb +3 -6
  126. data/lib/cucumber/formatter/pretty.rb +22 -9
  127. data/lib/cucumber/formatter/profile.rb +1 -1
  128. data/lib/cucumber/formatter/progress.rb +1 -1
  129. data/lib/cucumber/formatter/steps.rb +49 -0
  130. data/lib/cucumber/languages.yml +3 -3
  131. data/lib/cucumber/parser.rb +1 -33
  132. data/lib/cucumber/parser/feature.rb +39 -16
  133. data/lib/cucumber/parser/feature.tt +1 -3
  134. data/lib/cucumber/parser/i18n.tt +30 -23
  135. data/lib/cucumber/parser/i18n/language.rb +83 -0
  136. data/lib/cucumber/parser/treetop_ext.rb +12 -83
  137. data/lib/cucumber/platform.rb +6 -0
  138. data/lib/cucumber/rake/task.rb +6 -0
  139. data/lib/cucumber/step_definition.rb +6 -0
  140. data/lib/cucumber/step_match.rb +1 -1
  141. data/lib/cucumber/step_mother.rb +3 -3
  142. data/lib/cucumber/version.rb +1 -1
  143. data/lib/cucumber/webrat/table_locator.rb +66 -0
  144. data/rails_generators/cucumber/templates/cucumber.rake +4 -0
  145. data/rails_generators/cucumber/templates/env.rb +1 -0
  146. data/rails_generators/cucumber/templates/spork_env.rb +1 -1
  147. data/rails_generators/cucumber/templates/webrat_steps.rb +17 -0
  148. data/rails_generators/feature/templates/feature.erb +1 -1
  149. data/rails_generators/feature/templates/steps.erb +2 -8
  150. data/spec/cucumber/ast/step_collection_spec.rb +5 -4
  151. data/spec/cucumber/ast/table_spec.rb +145 -0
  152. data/spec/cucumber/cli/configuration_spec.rb +55 -9
  153. data/spec/cucumber/cli/drb_client_spec.rb +5 -4
  154. data/spec/cucumber/cli/main_spec.rb +9 -12
  155. data/spec/cucumber/formatter/progress_spec.rb +2 -2
  156. data/spec/cucumber/parser/feature_parser_spec.rb +11 -9
  157. data/spec/cucumber/parser/table_parser_spec.rb +1 -1
  158. data/spec/spec_helper.rb +2 -1
  159. metadata +21 -20
  160. data/spec/cucumber/formatter/html/cucumber.css +0 -37
  161. data/spec/cucumber/formatter/html/cucumber.js +0 -13
  162. data/spec/cucumber/formatter/html/index.html +0 -45
  163. data/spec/cucumber/formatter/html/jquery-1.3.min.js +0 -19
  164. data/spec/cucumber/formatter/html/jquery.uitableedit.js +0 -100
@@ -15,6 +15,7 @@ Cucumber::Rails.use_transactional_fixtures
15
15
  Cucumber::Rails.bypass_rescue
16
16
 
17
17
  require 'webrat'
18
+ require 'cucumber/webrat/table_locator' # Lets you do table.diff!(table_at('#my_table').to_a)
18
19
 
19
20
  Webrat.configure do |config|
20
21
  config.mode = :rails
@@ -3,7 +3,7 @@ require 'spork'
3
3
 
4
4
  Spork.prefork do
5
5
  # Sets up the Rails environment for Cucumber
6
- ENV["RAILS_ENV"] ||= "cucumber"
6
+ ENV["RAILS_ENV"] = "cucumber"
7
7
  require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
8
8
 
9
9
  require 'webrat'
@@ -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(&:name).join('|') %>|
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 |<%= plural_name %>|
13
- <%= plural_name %>.rows.each_with_index do |row, i|
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
- c = StepCollection.new([
8
- Step.new(1, 'Given', 'cukes'),
9
- Step.new(2, 'And', 'turnips')
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 == {'progress' => STDOUT}
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]['pretty'].should == 'jalla.txt'
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 == {'progress' => 'file2'}
287
+ config.options[:formats].should == [['progress', 'file2']]
265
288
  end
266
289
 
267
- it "should accept multiple --format options" do
268
- config = Configuration.new(StringIO.new)
269
- config.parse!(%w{--format pretty --format progress})
270
- config.options[:formats].should have_key('pretty')
271
- config.options[:formats].should have_key('progress')
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 == {"profile"=>"file2", "progress"=>"file1"}
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 false when it can't connect to the server" do
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 be_false
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 true when it connects to the server and runs the features" do
37
- DRbClient.run(@args, @error_stream, @out_stream).should be_true
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
- Parser::FeatureParser.stub!(:new).and_return(mock("feature parser", :parse_file => @empty_feature))
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(:load_language)
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).and_return(false) }
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: No DRb server is running. Running features locally:")
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', 10, nil)
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', 10, :skipped_param)
28
+ @progress.visit_table_cell_value('value', :skipped_param)
29
29
 
30
30
  @out.string.should == ""
31
31
  end