kosmas58-cucumber 0.3.9.4 → 0.3.11.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +45 -7
- data/Manifest.txt +403 -0
- data/cucumber.yml +4 -3
- data/examples/dos_line_endings/features/dos_line_endings.feature +9 -9
- data/features/drb_server_integration.feature +114 -0
- data/features/html_formatter/a.html +129 -1574
- data/features/junit_formatter.feature +11 -2
- data/features/step_definitions/cucumber_steps.rb +15 -2
- data/features/support/env.rb +35 -1
- data/gem_tasks/features.rake +7 -2
- data/lib/cucumber/ast/table.rb +6 -6
- data/lib/cucumber/cli/configuration.rb +32 -8
- data/lib/cucumber/cli/drb_client.rb +20 -0
- data/lib/cucumber/cli/main.rb +9 -0
- data/lib/cucumber/formatter/color_io.rb +2 -2
- data/lib/cucumber/formatter/console.rb +6 -1
- data/lib/cucumber/formatter/cucumber.css +106 -48
- data/lib/cucumber/formatter/cucumber.sass +121 -31
- data/lib/cucumber/formatter/html.rb +14 -3
- data/lib/cucumber/formatter/junit.rb +1 -2
- data/lib/cucumber/rake/task.rb +1 -1
- data/lib/cucumber/version.rb +2 -2
- data/rails_generators/cucumber/cucumber_generator.rb +15 -5
- data/rails_generators/cucumber/templates/cucumber.rake +5 -5
- data/rails_generators/cucumber/templates/de/paths.rb +3 -3
- data/rails_generators/cucumber/templates/de/webrat_steps.rb +11 -3
- data/rails_generators/cucumber/templates/env.rb +10 -3
- data/rails_generators/cucumber/templates/spork_env.rb +36 -0
- data/spec/cucumber/cli/configuration_spec.rb +56 -1
- data/spec/cucumber/cli/drb_client_spec.rb +43 -0
- data/spec/cucumber/cli/main_spec.rb +70 -19
- data/spec/spec_helper.rb +2 -0
- metadata +8 -9
- 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
@@ -1,39 +1,49 @@
|
|
1
1
|
# cucumber.css is generated from cucumber.sass
|
2
|
-
# Regenerate with
|
3
|
-
#
|
4
|
-
# sass -t expanded lib/cucumber/formatter/cucumber.sass > lib/cucumber/formatter/cucumber.css
|
5
|
-
#
|
6
|
-
.cucumber
|
7
|
-
:background black
|
8
|
-
:color white
|
9
|
-
:padding 1em
|
2
|
+
# Regenerate with rake sass
|
10
3
|
|
11
|
-
|
12
|
-
|
13
|
-
.undefined
|
14
|
-
:color yellow
|
15
|
-
.pending
|
16
|
-
:color yellow
|
17
|
-
.failed
|
18
|
-
:color red
|
19
|
-
.skipped
|
20
|
-
:color cyan
|
21
|
-
.outline
|
22
|
-
:color cyan
|
23
|
-
.param
|
24
|
-
:font-weight bold
|
4
|
+
!step_left = 5px solid
|
5
|
+
!step_bottom = 1px solid
|
25
6
|
|
26
|
-
|
27
|
-
|
28
|
-
|
7
|
+
!failed = #FFC0CB
|
8
|
+
!failed_dark = #FF0000
|
9
|
+
!failed_text = #8B0000
|
29
10
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
:font-weight normal
|
11
|
+
!passed = #98FB98
|
12
|
+
!passed_dark = #00FF00
|
13
|
+
!passed_text = #001111
|
34
14
|
|
35
|
-
|
36
|
-
|
15
|
+
!skipped = #E0FFFF
|
16
|
+
!skipped_dark = #00FFFF
|
17
|
+
!skipped_text = #001111
|
18
|
+
|
19
|
+
!pending = #FFFF00
|
20
|
+
!pending_dark = #FF8000
|
21
|
+
!pending_text = #2A1B0A
|
22
|
+
|
23
|
+
!undefined = #FFFF00
|
24
|
+
!undefined_dark = #FF8000
|
25
|
+
!undefined_text = #2A1B0A
|
26
|
+
|
27
|
+
.cucumber
|
28
|
+
:font-family "Lucida Grande", Helvetica, sans-serif
|
29
|
+
:font-size 0.7em
|
30
|
+
:background white
|
31
|
+
:padding 1em
|
32
|
+
|
33
|
+
h1, h2, h3, h4, ol, li, pre, p
|
34
|
+
:font-size 1em
|
35
|
+
:padding 0px
|
36
|
+
:margin 0px
|
37
|
+
|
38
|
+
div.feature
|
39
|
+
:border 1px solid
|
40
|
+
:padding 2px
|
41
|
+
:margin 4px
|
42
|
+
|
43
|
+
div.background, div.scenario, p
|
44
|
+
:padding 0em 0em 0em 1em
|
45
|
+
div.examples
|
46
|
+
:padding 0em 0em 0em 1em
|
37
47
|
|
38
48
|
.stats
|
39
49
|
:margin 2em
|
@@ -47,3 +57,83 @@
|
|
47
57
|
:margin-top 0
|
48
58
|
:margin-bottom 0
|
49
59
|
:margin-left 1em
|
60
|
+
|
61
|
+
a
|
62
|
+
:text-decoration none
|
63
|
+
:color inherit
|
64
|
+
|
65
|
+
&:hover
|
66
|
+
:text-decoration underline
|
67
|
+
&:visited
|
68
|
+
:font-weight normal
|
69
|
+
|
70
|
+
div.examples
|
71
|
+
:border 1px solid
|
72
|
+
:padding 2px
|
73
|
+
:margin 4px
|
74
|
+
|
75
|
+
table
|
76
|
+
:border-collapse collapse
|
77
|
+
|
78
|
+
td, th
|
79
|
+
:font-size 0.7em
|
80
|
+
:border 1px solid #AAAAAA
|
81
|
+
td.failed
|
82
|
+
:background #FFC0CB
|
83
|
+
:color #8B0000
|
84
|
+
td.passed
|
85
|
+
:background #98FB98
|
86
|
+
:color= !passed_text
|
87
|
+
td.skipped
|
88
|
+
:background= !skipped
|
89
|
+
:color= !skipped_text
|
90
|
+
td.pending
|
91
|
+
:background #FFFFE0
|
92
|
+
:color #111100
|
93
|
+
td.undefined
|
94
|
+
:background #FFFFE0
|
95
|
+
:color #111100
|
96
|
+
|
97
|
+
ol
|
98
|
+
:list-style none
|
99
|
+
|
100
|
+
li
|
101
|
+
:margin 0em 0em 0em 1em
|
102
|
+
:padding 0em 0em 0em 0.2em
|
103
|
+
span.param
|
104
|
+
:font-weight bold
|
105
|
+
li.failed
|
106
|
+
:border-left= !step_left !failed_dark
|
107
|
+
:border-bottom= !step_bottom !failed_dark
|
108
|
+
:background= !failed
|
109
|
+
:color= !failed_text
|
110
|
+
span.param
|
111
|
+
:background !failed_dark
|
112
|
+
li.passed
|
113
|
+
:border-left= !step_left !passed_dark
|
114
|
+
:border-bottom= !step_bottom !passed_dark
|
115
|
+
:background= !passed
|
116
|
+
:color= !passed_text
|
117
|
+
span.param
|
118
|
+
:background= !passed_dark
|
119
|
+
li.skipped
|
120
|
+
:border-left= !step_left !skipped_dark
|
121
|
+
:border-bottom= !step_bottom !skipped_dark
|
122
|
+
:background= !skipped
|
123
|
+
:color= !skipped_text
|
124
|
+
span.param
|
125
|
+
:background= !skipped_dark
|
126
|
+
li.pending
|
127
|
+
:border-left= !step_left !pending_dark
|
128
|
+
:border-bottom= !step_bottom !pending_dark
|
129
|
+
:background= !pending
|
130
|
+
:color= !pending_text
|
131
|
+
span.param
|
132
|
+
:background= !pending_dark
|
133
|
+
li.undefined
|
134
|
+
:border-left= !step_left !undefined_dark
|
135
|
+
:border-bottom= !step_bottom !undefined_dark
|
136
|
+
:background= !undefined
|
137
|
+
:color= !undefined_text
|
138
|
+
span.param
|
139
|
+
:background= !undefined_dark
|
@@ -16,7 +16,11 @@ module Cucumber
|
|
16
16
|
def initialize(step_mother, io, options)
|
17
17
|
super(step_mother)
|
18
18
|
@options = options
|
19
|
-
@builder =
|
19
|
+
@builder = create_builder(io)
|
20
|
+
end
|
21
|
+
|
22
|
+
def create_builder(io)
|
23
|
+
Builder::XmlMarkup.new(:target => io, :indent => 0)
|
20
24
|
end
|
21
25
|
|
22
26
|
def visit_features(features)
|
@@ -89,6 +93,7 @@ module Cucumber
|
|
89
93
|
@listing_background = true
|
90
94
|
@builder.h3 do |h3|
|
91
95
|
@builder.span(keyword, :class => 'keyword')
|
96
|
+
@builder.text!(' ')
|
92
97
|
@builder.span(name, :class => 'val')
|
93
98
|
end
|
94
99
|
end
|
@@ -108,6 +113,7 @@ module Cucumber
|
|
108
113
|
@listing_background = false
|
109
114
|
@builder.h3 do
|
110
115
|
@builder.span(keyword, :class => 'keyword')
|
116
|
+
@builder.text!(' ')
|
111
117
|
@builder.span(name, :class => 'val')
|
112
118
|
end
|
113
119
|
end
|
@@ -127,7 +133,11 @@ module Cucumber
|
|
127
133
|
end
|
128
134
|
|
129
135
|
def visit_examples_name(keyword, name)
|
130
|
-
@builder.h4
|
136
|
+
@builder.h4 do
|
137
|
+
@builder.span(keyword, :class => 'keyword')
|
138
|
+
@builder.text!(' ')
|
139
|
+
@builder.span(name, :class => 'val')
|
140
|
+
end
|
131
141
|
end
|
132
142
|
|
133
143
|
def visit_steps(steps)
|
@@ -181,7 +191,7 @@ module Cucumber
|
|
181
191
|
|
182
192
|
def visit_py_string(string)
|
183
193
|
@builder.pre(:class => 'val') do |pre|
|
184
|
-
|
194
|
+
@builder.text!(' ' + string)
|
185
195
|
end
|
186
196
|
end
|
187
197
|
|
@@ -221,6 +231,7 @@ module Cucumber
|
|
221
231
|
step_name = step_match.format_args(lambda{|param| %{<span class="param">#{param}</span>}})
|
222
232
|
@builder.div do |div|
|
223
233
|
@builder.span(keyword, :class => 'keyword')
|
234
|
+
@builder.text!(' ')
|
224
235
|
@builder.span(:class => 'step val') do |name|
|
225
236
|
name << h(step_name).gsub(/<span class="(.*?)">/, '<span class="\1">').gsub(/<\/span>/, '</span>')
|
226
237
|
end
|
@@ -11,10 +11,9 @@ module Cucumber
|
|
11
11
|
|
12
12
|
def initialize(step_mother, io, options)
|
13
13
|
super(step_mother)
|
14
|
+
raise "You *must* specify --out DIR for the junit formatter" unless String === io && File.directory?(io)
|
14
15
|
@reportdir = io
|
15
16
|
@options = options
|
16
|
-
raise "You *must* specify --out DIR for the junit formatter" unless @reportdir
|
17
|
-
raise "Use --out DIR (not --out FILE) for the junit formatter" if File === @reportdir
|
18
17
|
end
|
19
18
|
|
20
19
|
def visit_feature(feature)
|
data/lib/cucumber/rake/task.rb
CHANGED
@@ -90,7 +90,7 @@ module Cucumber
|
|
90
90
|
class_eval <<-EOF, __FILE__, __LINE__ + 1
|
91
91
|
def #{attribute}=(value)
|
92
92
|
@#{attribute} = value
|
93
|
-
warn("Cucumber::Rake::Task##{attribute} is deprecated and will be removed in 0.4.0. Please use profiles for complex settings: http://wiki.github.com/aslakhellesoy/cucumber/using-rake#profiles")
|
93
|
+
warn("\nWARNING: Cucumber::Rake::Task##{attribute} is deprecated and will be removed in 0.4.0. Please use profiles for complex settings: http://wiki.github.com/aslakhellesoy/cucumber/using-rake#profiles\n")
|
94
94
|
end
|
95
95
|
EOF
|
96
96
|
end
|
data/lib/cucumber/version.rb
CHANGED
@@ -21,12 +21,18 @@ class CucumberGenerator < Rails::Generator::Base
|
|
21
21
|
m.gsub_file 'config/database.yml', /test:.*\n/, "test: &TEST\n"
|
22
22
|
m.gsub_file 'config/database.yml', /\z/, "\ncucumber:\n <<: *TEST"
|
23
23
|
|
24
|
-
m.directory
|
25
|
-
|
24
|
+
m.directory 'features/support'
|
25
|
+
|
26
|
+
if options[:spork]
|
27
|
+
m.template 'spork_env.rb', 'features/support/env.rb'
|
28
|
+
else
|
29
|
+
m.template 'env.rb', 'features/support/env.rb'
|
30
|
+
end
|
31
|
+
|
26
32
|
m.file File.join(lang, "paths.rb"), "features/support/paths.rb"
|
27
33
|
|
28
|
-
m.directory
|
29
|
-
m.template
|
34
|
+
m.directory 'lib/tasks'
|
35
|
+
m.template 'cucumber.rake', 'lib/tasks/cucumber.rake'
|
30
36
|
|
31
37
|
m.file "cucumber", "script/cucumber", {
|
32
38
|
:chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang]
|
@@ -72,9 +78,13 @@ protected
|
|
72
78
|
options[:framework] = :testunit
|
73
79
|
end
|
74
80
|
|
75
|
-
|
81
|
+
opt.on('--language [lang]', 'Setup cucumber for use with language [lang] ("en" is default') do |value|
|
76
82
|
options[:language] = value || :en
|
77
83
|
end
|
84
|
+
|
85
|
+
opt.on('--spork', 'Setup cucumber for use with Spork') do |value|
|
86
|
+
options[:spork] = true
|
87
|
+
end
|
78
88
|
end
|
79
89
|
|
80
90
|
end
|
@@ -3,13 +3,13 @@ $LOAD_PATH.unshift(RAILS_ROOT + '/vendor/plugins/cucumber/lib') if File.director
|
|
3
3
|
begin
|
4
4
|
require 'cucumber/rake/task'
|
5
5
|
|
6
|
-
Cucumber::Rake::Task.new(:features) do |t|
|
7
|
-
t.fork = true
|
6
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
7
|
+
t.fork = true
|
8
8
|
<% if language == :en %>
|
9
|
-
t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'pretty')]
|
9
|
+
t.cucumber_opts = [<%= options[:spork] ? "'--drb', " : "" %>'--format', (ENV['CUCUMBER_FORMAT'] || 'pretty')]
|
10
10
|
<% else %>
|
11
|
-
t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'pretty'), '--language', <%= language%>]
|
12
|
-
<% end %>
|
11
|
+
t.cucumber_opts = [<%= options[:spork] ? "'--drb', " : "" %>'--format', (ENV['CUCUMBER_FORMAT'] || 'pretty'), '--language', <%= language%>]
|
12
|
+
<% end %>
|
13
13
|
end
|
14
14
|
task :features => 'db:test:prepare'
|
15
15
|
rescue LoadError
|
@@ -8,15 +8,15 @@ module NavigationHelpers
|
|
8
8
|
def path_to(page_name)
|
9
9
|
case page_name
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
when /Startseite/
|
12
|
+
'/'
|
13
13
|
|
14
14
|
# Add more mappings here.
|
15
15
|
# Here is a more fancy example:
|
16
16
|
#
|
17
17
|
# when /^(.*)'s profile page$/i
|
18
18
|
# user_profile_path(User.find_by_login($1))
|
19
|
-
|
19
|
+
|
20
20
|
else
|
21
21
|
raise "Kann für \"#{page_name}\" kein Mapping zu einem Pfad finden.\n" +
|
22
22
|
"Sie sollten jetzt ein Mapping in #{__FILE__} hinzufügen."
|
@@ -40,8 +40,8 @@ end
|
|
40
40
|
# <%%= f.label :alternative %><br />
|
41
41
|
# <%%= f.datetime_select :alternative %>
|
42
42
|
# The following steps would fill out the form:
|
43
|
-
# When I select "November 23, 2004 11:20" as the "Preferred"
|
44
|
-
# And I select "November 25, 2004 10:30" as the "Alternative"
|
43
|
+
# When I select "November 23, 2004 11:20" as the "Preferred" date and time
|
44
|
+
# And I select "November 25, 2004 10:30" as the "Alternative" date and time
|
45
45
|
When /^ich "([^\"]*)" als "([^\"]*)" Datum und Uhrzeit wähle$/ do |datetime, datetime_label|
|
46
46
|
select_datetime(datetime, :from => datetime_label)
|
47
47
|
end
|
@@ -121,7 +121,7 @@ Then /^sollte das Feld "([^\"]*)" nicht "([^\"]*)" enthalten$/ do |field, value|
|
|
121
121
|
assert_no_match(/#{value}/, field_labeled(field).value)
|
122
122
|
<% end -%>
|
123
123
|
end
|
124
|
-
|
124
|
+
|
125
125
|
Then /^sollte das "([^\"]*)" Kästchen ausgewählt sein$/ do |label|
|
126
126
|
<% if framework == :rspec -%>
|
127
127
|
field_labeled(label).should be_checked
|
@@ -130,6 +130,14 @@ Then /^sollte das "([^\"]*)" Kästchen ausgewählt sein$/ do |label|
|
|
130
130
|
<% end -%>
|
131
131
|
end
|
132
132
|
|
133
|
+
Then /^sollte das Kästchen "([^\"]*)" nicht ausgewählt sein$/ 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 /^sollte ich auf (.+) sein$/ do |page_name|
|
134
142
|
<% if framework == :rspec -%>
|
135
143
|
URI.parse(current_url).path.should == path_to(page_name)
|
@@ -2,10 +2,17 @@
|
|
2
2
|
ENV["RAILS_ENV"] ||= "cucumber"
|
3
3
|
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
|
4
4
|
require 'cucumber/rails/world'
|
5
|
-
|
5
|
+
|
6
|
+
# Comment out the next line if you don't want Cucumber Unicode support
|
7
|
+
require 'cucumber/formatter/unicode'
|
8
|
+
|
9
|
+
# Comment out the next line if you don't want transactions to
|
10
|
+
# open/roll back around each scenario
|
6
11
|
Cucumber::Rails.use_transactional_fixtures
|
7
|
-
|
8
|
-
|
12
|
+
|
13
|
+
# Comment out the next line if you want Rails' own error handling
|
14
|
+
# (e.g. rescue_action_in_public / rescue_responses / rescue_from)
|
15
|
+
Cucumber::Rails.bypass_rescue
|
9
16
|
|
10
17
|
require 'webrat'
|
11
18
|
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'spork'
|
3
|
+
|
4
|
+
Spork.prefork do
|
5
|
+
# Sets up the Rails environment for Cucumber
|
6
|
+
ENV["RAILS_ENV"] = "cucumber"
|
7
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
|
8
|
+
|
9
|
+
require 'webrat'
|
10
|
+
|
11
|
+
Webrat.configure do |config|
|
12
|
+
config.mode = :rails
|
13
|
+
end
|
14
|
+
|
15
|
+
require 'webrat/core/matchers'
|
16
|
+
require 'cucumber'
|
17
|
+
|
18
|
+
# Comment out the next line if you don't want Cucumber Unicode support
|
19
|
+
require 'cucumber/formatter/unicode'
|
20
|
+
|
21
|
+
require 'spec/rails'
|
22
|
+
require 'cucumber/rails/rspec'
|
23
|
+
end
|
24
|
+
|
25
|
+
Spork.each_run do
|
26
|
+
# This code will be run each time you run your specs.
|
27
|
+
require 'cucumber/rails/world'
|
28
|
+
|
29
|
+
# Comment out the next line if you don't want transactions to
|
30
|
+
# open/roll back around each scenario
|
31
|
+
Cucumber::Rails.use_transactional_fixtures
|
32
|
+
|
33
|
+
# Comment out the next line if you want Rails' own error handling
|
34
|
+
# (e.g. rescue_action_in_public / rescue_responses / rescue_from)
|
35
|
+
Cucumber::Rails.bypass_rescue
|
36
|
+
end
|
@@ -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
|
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,43 @@
|
|
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 raises an error when it can't connect to the server" do
|
32
|
+
DRbObject.stub!(:new_with_uri).and_raise(DRb::DRbConnError)
|
33
|
+
running { DRbClient.run(@args, @error_stream, @out_stream) }.should raise_error(DRbClientError, "No DRb server is running.")
|
34
|
+
end
|
35
|
+
|
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'
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|