cucumber 0.3.9 → 0.3.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/History.txt +40 -0
  2. data/Manifest.txt +10 -0
  3. data/cucumber.yml +1 -1
  4. data/examples/i18n/pl/Rakefile +6 -0
  5. data/examples/i18n/pl/features/addition.feature +16 -0
  6. data/examples/i18n/pl/features/division.feature +9 -0
  7. data/examples/i18n/pl/features/step_definitons/calculator_steps.rb +24 -0
  8. data/examples/i18n/pl/features/support/env.rb +6 -0
  9. data/examples/i18n/pl/lib/calculator.rb +14 -0
  10. data/examples/self_test/features/sample.feature +2 -0
  11. data/features/cucumber_cli.feature +24 -6
  12. data/features/drb_server_integration.feature +92 -0
  13. data/features/html_formatter/a.html +926 -437
  14. data/features/junit_formatter.feature +11 -2
  15. data/features/step_definitions/cucumber_steps.rb +15 -2
  16. data/features/support/env.rb +35 -1
  17. data/features/usage.feature +2 -2
  18. data/lib/cucumber/ast/background.rb +1 -1
  19. data/lib/cucumber/ast/comment.rb +4 -0
  20. data/lib/cucumber/ast/feature.rb +2 -1
  21. data/lib/cucumber/ast/outline_table.rb +2 -2
  22. data/lib/cucumber/ast/scenario.rb +1 -1
  23. data/lib/cucumber/ast/scenario_outline.rb +11 -4
  24. data/lib/cucumber/ast/step_invocation.rb +17 -12
  25. data/lib/cucumber/ast/visitor.rb +4 -0
  26. data/lib/cucumber/cli/configuration.rb +32 -8
  27. data/lib/cucumber/cli/drb_client.rb +21 -0
  28. data/lib/cucumber/cli/main.rb +9 -0
  29. data/lib/cucumber/formatter/color_io.rb +2 -2
  30. data/lib/cucumber/formatter/console.rb +1 -3
  31. data/lib/cucumber/formatter/html.rb +63 -12
  32. data/lib/cucumber/formatter/junit.rb +2 -2
  33. data/lib/cucumber/formatter/pretty.rb +2 -1
  34. data/lib/cucumber/formatter/rerun.rb +1 -0
  35. data/lib/cucumber/formatter/tag_cloud.rb +1 -0
  36. data/lib/cucumber/rails/rspec.rb +5 -3
  37. data/lib/cucumber/rake/task.rb +1 -1
  38. data/lib/cucumber/step_match.rb +6 -2
  39. data/lib/cucumber/step_mother.rb +11 -8
  40. data/lib/cucumber/version.rb +1 -1
  41. data/rails_generators/cucumber/cucumber_generator.rb +12 -2
  42. data/rails_generators/cucumber/templates/cucumber.rake +1 -1
  43. data/rails_generators/cucumber/templates/cucumber_environment.rb +6 -4
  44. data/rails_generators/cucumber/templates/env.rb +10 -3
  45. data/rails_generators/cucumber/templates/spork_env.rb +36 -0
  46. data/rails_generators/cucumber/templates/webrat_steps.rb +8 -0
  47. data/spec/cucumber/cli/configuration_spec.rb +56 -1
  48. data/spec/cucumber/cli/drb_client_spec.rb +42 -0
  49. data/spec/cucumber/cli/main_spec.rb +64 -19
  50. metadata +12 -2
@@ -130,6 +130,14 @@ Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
130
130
  <% end -%>
131
131
  end
132
132
 
133
+ Then /^the "([^\"]*)" checkbox should not be checked$/ do |label|
134
+ <% if framework == :rspec -%>
135
+ field_labeled(label).should_not be_checked
136
+ <% else -%>
137
+ assert !field_labeled(label).checked?
138
+ <% end -%>
139
+ end
140
+
133
141
  Then /^I should be on (.+)$/ do |page_name|
134
142
  <% if framework == :rspec -%>
135
143
  URI.parse(current_url).path.should == path_to(page_name)
@@ -83,6 +83,61 @@ module Cli
83
83
  end
84
84
  end
85
85
 
86
+ describe '#drb?' do
87
+ it "indicates whether the --drb flag was passed in or not" do
88
+ config = Configuration.new(StringIO.new)
89
+
90
+ config.parse!(%w{features})
91
+ config.drb?.should == false
92
+
93
+
94
+ config.parse!(%w{features --drb})
95
+ config.drb?.should == true
96
+ end
97
+ end
98
+
99
+ context '--drb' do
100
+ it "removes the --drb flag from the args" do
101
+ config = Configuration.new(StringIO.new)
102
+
103
+ args = %w{features --drb}
104
+ config.parse!(args)
105
+ args.should == %w{features}
106
+ end
107
+
108
+ it "keeps all other flags intact" do
109
+ config = Configuration.new(StringIO.new)
110
+
111
+ args = %w{features --drb --format profile}
112
+ config.parse!(args)
113
+ args.should == %w{features --format profile}
114
+ end
115
+
116
+ end
117
+
118
+ context '--drb in a profile' do
119
+ it "removes the --drb flag from the args" do
120
+ given_cucumber_yml_defined_as({'server' => '--drb features'})
121
+ config = Configuration.new(StringIO.new)
122
+
123
+ args = %w{--profile server}
124
+ config.parse!(args)
125
+ args.should == %w{features}
126
+ end
127
+
128
+ it "keeps all other flags intact from all profiles involved" do
129
+ given_cucumber_yml_defined_as({'server' => '--drb features --profile nested',
130
+ 'nested' => '--verbose'})
131
+
132
+ config = Configuration.new(StringIO.new)
133
+
134
+ args = %w{--profile server --format profile}
135
+ config.parse!(args)
136
+ args.should == %w{features --verbose --format profile}
137
+ end
138
+
139
+ end
140
+
86
141
  it "should expand args from YAML file" do
87
142
  given_cucumber_yml_defined_as({'bongo' => '--require from/yml'})
88
143
 
@@ -156,7 +211,7 @@ END_OF_MESSAGE
156
211
  expected_error_message = /cucumber.yml was found, but could not be parsed. Please refer to cucumber's documentation on correct profile usage./
157
212
 
158
213
  given_cucumber_yml_defined_as("input that causes an exception in YAML loading")
159
- YAML.should_receive(:load).and_raise Exception
214
+ YAML.should_receive(:load).and_raise ArgumentError
160
215
 
161
216
  config = Configuration.new(StringIO.new, error = StringIO.new)
162
217
  lambda{config.parse!([])}.should raise_error(expected_error_message)
@@ -0,0 +1,42 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+
4
+ module Cucumber
5
+ module Cli
6
+ describe DRbClient do
7
+ before(:each) do
8
+ @args = ['features']
9
+ @error_stream = StringIO.new
10
+ @out_stream = StringIO.new
11
+
12
+ @drb_object = mock('DRbObject', :run => true)
13
+ DRbObject.stub!(:new_with_uri).and_return(@drb_object)
14
+ end
15
+
16
+ it "starts up a druby service" do
17
+ DRb.should_receive(:start_service).with("druby://localhost:0")
18
+ DRbClient.run(@args, @error_stream, @out_stream)
19
+ end
20
+
21
+ it "connects to the DRb server" do
22
+ DRbObject.should_receive(:new_with_uri).with("druby://127.0.0.1:8990")
23
+ DRbClient.run(@args, @error_stream, @out_stream)
24
+ end
25
+
26
+ it "runs the fearures on the DRb server" do
27
+ @drb_object.should_receive(:run).with(@args, @error_stream, @out_stream)
28
+ DRbClient.run(@args, @error_stream, @out_stream)
29
+ end
30
+
31
+ it "returns false when it can't connect to the server" do
32
+ DRbObject.stub!(:new_with_uri).and_raise(DRb::DRbConnError)
33
+ DRbClient.run(@args, @error_stream, @out_stream).should be_false
34
+ end
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
38
+ end
39
+
40
+ end
41
+ end
42
+ end
@@ -11,11 +11,12 @@ module Cucumber
11
11
  describe Main do
12
12
  before(:each) do
13
13
  @out = StringIO.new
14
+ @err = StringIO.new
14
15
  Kernel.stub!(:exit).and_return(nil)
15
16
  end
16
17
 
17
18
  describe "verbose mode" do
18
-
19
+
19
20
  before(:each) do
20
21
  @empty_feature = Ast::Feature.new(nil, Ast::Comment.new(''), Ast::Tags.new(2, []), "Feature", [])
21
22
  Dir.stub!(:[])
@@ -24,56 +25,56 @@ module Cucumber
24
25
  it "should show ruby files required" do
25
26
  @cli = Main.new(%w{--verbose --require example.rb}, @out)
26
27
  @cli.stub!(:require)
27
-
28
+
28
29
  @cli.execute!(Object.new.extend(StepMother))
29
-
30
+
30
31
  @out.string.should include('example.rb')
31
32
  end
32
-
33
+
33
34
  it "should show feature files parsed" do
34
35
  @cli = Main.new(%w{--verbose example.feature}, @out)
35
36
  @cli.stub!(:require)
36
-
37
+
37
38
  Parser::FeatureParser.stub!(:new).and_return(mock("feature parser", :parse_file => @empty_feature))
38
-
39
+
39
40
  @cli.execute!(Object.new.extend(StepMother))
40
41
 
41
42
  @out.string.should include('example.feature')
42
43
  end
43
-
44
+
44
45
  end
45
46
 
46
47
  describe "diffing" do
47
48
 
48
49
  before :each do
49
- @configuration = mock('Configuration', :null_object => true)
50
+ @configuration = mock('Configuration', :null_object => true, :drb? => false)
50
51
  Configuration.should_receive(:new).and_return(@configuration)
51
-
52
+
52
53
  @step_mother = mock('StepMother', :null_object => true)
53
-
54
+
54
55
  @cli = Main.new(nil, @out)
55
56
  end
56
-
57
+
57
58
  it "uses Spec Differ::Default when diff is enabled" do
58
59
  @configuration.should_receive(:diff_enabled?).and_return(true)
59
-
60
+
60
61
  ::Spec::Expectations::Differs::Default.should_receive(:new)
61
-
62
+
62
63
  @cli.execute!(@step_mother)
63
64
  end
64
-
65
+
65
66
  it "does not use Spec Differ::Default when diff is disabled" do
66
67
  @configuration.should_receive(:diff_enabled?).and_return(false)
67
-
68
+
68
69
  ::Spec::Expectations::Differs::Default.should_not_receive(:new)
69
-
70
+
70
71
  @cli.execute!(@step_mother)
71
72
  end
72
-
73
+
73
74
  end
74
75
 
75
76
  describe "--format with class" do
76
-
77
+
77
78
  describe "in module" do
78
79
 
79
80
  it "should resolve each module until it gets Formatter class" do
@@ -90,8 +91,52 @@ module Cucumber
90
91
  cli.execute!(Object.new.extend(StepMother))
91
92
  end
92
93
 
93
- end
94
+ end
94
95
  end
96
+
97
+ context "--drb" do
98
+ before(:each) do
99
+ @configuration = mock('Configuration', :drb? => true, :null_object => true)
100
+ Configuration.stub!(:new).and_return(@configuration)
101
+
102
+ @args = ['features']
103
+
104
+ @cli = Main.new(@args, @out, @err)
105
+ @step_mother = mock('StepMother', :null_object => true)
106
+ end
107
+
108
+ it "delegates the execution to the DRB client passing the args and streams" do
109
+ DRbClient.should_receive(:run).with(@args, @err, @out).and_return(true)
110
+ @cli.execute!(@step_mother)
111
+ end
112
+
113
+ it "ceases execution if the DrbClient is able to perform the execution" do
114
+ DRbClient.stub!(:run).and_return(true)
115
+ @configuration.should_not_receive(:load_language)
116
+ @cli.execute!(@step_mother)
117
+ end
118
+
119
+ context "when the DrbClient is unable to perfrom the execution" do
120
+ before { DRbClient.stub!(:run).and_return(false) }
121
+
122
+ it "alerts the user that execution will be performed locally" do
123
+ @cli.execute!(@step_mother)
124
+ @err.string.should include("WARNING: No DRb server is running. Running features locally:")
125
+ end
126
+
127
+ it "reparses the configuration since the --drb flag causes the initial parsing to short circuit" do
128
+ @configuration.should_receive(:parse!).exactly(:twice)
129
+ @cli.execute!(@step_mother)
130
+ end
131
+
132
+ it "proceeds with the execution locally" do
133
+ @configuration.should_receive(:load_language)
134
+ @cli.execute!(@step_mother)
135
+ end
136
+ end
137
+
138
+ end
139
+
95
140
  end
96
141
  end
97
142
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Aslak Helles\xC3\xB8y"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-27 00:00:00 +02:00
12
+ date: 2009-06-05 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -192,6 +192,12 @@ files:
192
192
  - examples/i18n/no/features/summering.feature
193
193
  - examples/i18n/no/features/support/env.rb
194
194
  - examples/i18n/no/lib/kalkulator.rb
195
+ - examples/i18n/pl/Rakefile
196
+ - examples/i18n/pl/features/addition.feature
197
+ - examples/i18n/pl/features/division.feature
198
+ - examples/i18n/pl/features/step_definitons/calculator_steps.rb
199
+ - examples/i18n/pl/features/support/env.rb
200
+ - examples/i18n/pl/lib/calculator.rb
195
201
  - examples/i18n/pt/Rakefile
196
202
  - examples/i18n/pt/features/adicao.feature
197
203
  - examples/i18n/pt/features/step_definitions/calculadora_steps.rb
@@ -321,6 +327,7 @@ files:
321
327
  - features/cucumber_cli_diff_disabled.feature
322
328
  - features/cucumber_cli_outlines.feature
323
329
  - features/custom_formatter.feature
330
+ - features/drb_server_integration.feature
324
331
  - features/exclude_files.feature
325
332
  - features/expand.feature
326
333
  - features/html_formatter.feature
@@ -369,6 +376,7 @@ files:
369
376
  - lib/cucumber/ast/visitor.rb
370
377
  - lib/cucumber/broadcaster.rb
371
378
  - lib/cucumber/cli/configuration.rb
379
+ - lib/cucumber/cli/drb_client.rb
372
380
  - lib/cucumber/cli/language_help_formatter.rb
373
381
  - lib/cucumber/cli/main.rb
374
382
  - lib/cucumber/core_ext/exception.rb
@@ -416,6 +424,7 @@ files:
416
424
  - rails_generators/cucumber/templates/cucumber_environment.rb
417
425
  - rails_generators/cucumber/templates/env.rb
418
426
  - rails_generators/cucumber/templates/paths.rb
427
+ - rails_generators/cucumber/templates/spork_env.rb
419
428
  - rails_generators/cucumber/templates/webrat_steps.rb
420
429
  - rails_generators/feature/USAGE
421
430
  - rails_generators/feature/feature_generator.rb
@@ -434,6 +443,7 @@ files:
434
443
  - spec/cucumber/ast/visitor_spec.rb
435
444
  - spec/cucumber/broadcaster_spec.rb
436
445
  - spec/cucumber/cli/configuration_spec.rb
446
+ - spec/cucumber/cli/drb_client_spec.rb
437
447
  - spec/cucumber/cli/main_spec.rb
438
448
  - spec/cucumber/core_ext/proc_spec.rb
439
449
  - spec/cucumber/core_ext/string_spec.rb