aslakhellesoy-cucumber 0.3.9.4 → 0.3.9.5

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.
@@ -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
@@ -15,7 +15,7 @@ module Cucumber
15
15
  end
16
16
 
17
17
  describe "verbose mode" do
18
-
18
+
19
19
  before(:each) do
20
20
  @empty_feature = Ast::Feature.new(nil, Ast::Comment.new(''), Ast::Tags.new(2, []), "Feature", [])
21
21
  Dir.stub!(:[])
@@ -24,56 +24,56 @@ module Cucumber
24
24
  it "should show ruby files required" do
25
25
  @cli = Main.new(%w{--verbose --require example.rb}, @out)
26
26
  @cli.stub!(:require)
27
-
27
+
28
28
  @cli.execute!(Object.new.extend(StepMother))
29
-
29
+
30
30
  @out.string.should include('example.rb')
31
31
  end
32
-
32
+
33
33
  it "should show feature files parsed" do
34
34
  @cli = Main.new(%w{--verbose example.feature}, @out)
35
35
  @cli.stub!(:require)
36
-
36
+
37
37
  Parser::FeatureParser.stub!(:new).and_return(mock("feature parser", :parse_file => @empty_feature))
38
-
38
+
39
39
  @cli.execute!(Object.new.extend(StepMother))
40
40
 
41
41
  @out.string.should include('example.feature')
42
42
  end
43
-
43
+
44
44
  end
45
45
 
46
46
  describe "diffing" do
47
47
 
48
48
  before :each do
49
- @configuration = mock('Configuration', :null_object => true)
49
+ @configuration = mock('Configuration', :null_object => true, :drb? => false)
50
50
  Configuration.should_receive(:new).and_return(@configuration)
51
-
51
+
52
52
  @step_mother = mock('StepMother', :null_object => true)
53
-
53
+
54
54
  @cli = Main.new(nil, @out)
55
55
  end
56
-
56
+
57
57
  it "uses Spec Differ::Default when diff is enabled" do
58
58
  @configuration.should_receive(:diff_enabled?).and_return(true)
59
-
59
+
60
60
  ::Spec::Expectations::Differs::Default.should_receive(:new)
61
-
61
+
62
62
  @cli.execute!(@step_mother)
63
63
  end
64
-
64
+
65
65
  it "does not use Spec Differ::Default when diff is disabled" do
66
66
  @configuration.should_receive(:diff_enabled?).and_return(false)
67
-
67
+
68
68
  ::Spec::Expectations::Differs::Default.should_not_receive(:new)
69
-
69
+
70
70
  @cli.execute!(@step_mother)
71
71
  end
72
-
72
+
73
73
  end
74
74
 
75
75
  describe "--format with class" do
76
-
76
+
77
77
  describe "in module" do
78
78
 
79
79
  it "should resolve each module until it gets Formatter class" do
@@ -90,8 +90,53 @@ module Cucumber
90
90
  cli.execute!(Object.new.extend(StepMother))
91
91
  end
92
92
 
93
- end
93
+ end
94
94
  end
95
+
96
+ context "--drb" do
97
+ before(:each) do
98
+ @configuration = mock('Configuration', :drb? => true, :null_object => true)
99
+ Configuration.stub!(:new).and_return(@configuration)
100
+ @error_stream = mock('standard error')
101
+
102
+ @args = ['features']
103
+
104
+ @cli = Main.new(@args, @out, @error_stream)
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, @error_stream, @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
+ @out.string.should include("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: aslakhellesoy-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9.4
4
+ version: 0.3.9.5
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-06-03 00:00:00 -07:00
12
+ date: 2009-06-04 00:00:00 -07:00
13
13
  default_executable: cucumber
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -327,6 +327,7 @@ files:
327
327
  - features/cucumber_cli_diff_disabled.feature
328
328
  - features/cucumber_cli_outlines.feature
329
329
  - features/custom_formatter.feature
330
+ - features/drb_server_integration.feature
330
331
  - features/exclude_files.feature
331
332
  - features/expand.feature
332
333
  - features/html_formatter.feature
@@ -375,6 +376,7 @@ files:
375
376
  - lib/cucumber/ast/visitor.rb
376
377
  - lib/cucumber/broadcaster.rb
377
378
  - lib/cucumber/cli/configuration.rb
379
+ - lib/cucumber/cli/drb_client.rb
378
380
  - lib/cucumber/cli/language_help_formatter.rb
379
381
  - lib/cucumber/cli/main.rb
380
382
  - lib/cucumber/core_ext/exception.rb
@@ -422,6 +424,7 @@ files:
422
424
  - rails_generators/cucumber/templates/cucumber_environment.rb
423
425
  - rails_generators/cucumber/templates/env.rb
424
426
  - rails_generators/cucumber/templates/paths.rb
427
+ - rails_generators/cucumber/templates/spork_env.rb
425
428
  - rails_generators/cucumber/templates/webrat_steps.rb
426
429
  - rails_generators/feature/USAGE
427
430
  - rails_generators/feature/feature_generator.rb
@@ -440,6 +443,7 @@ files:
440
443
  - spec/cucumber/ast/visitor_spec.rb
441
444
  - spec/cucumber/broadcaster_spec.rb
442
445
  - spec/cucumber/cli/configuration_spec.rb
446
+ - spec/cucumber/cli/drb_client_spec.rb
443
447
  - spec/cucumber/cli/main_spec.rb
444
448
  - spec/cucumber/core_ext/proc_spec.rb
445
449
  - spec/cucumber/core_ext/string_spec.rb