cucumber 0.1.12 → 0.1.13
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 +38 -3
- data/Manifest.txt +17 -1
- data/README.txt +2 -39
- data/bin/cucumber +1 -1
- data/examples/calculator_ruby_features/features/addition.rb +16 -0
- data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +1 -0
- data/examples/i18n/de/features/step_definitons/calculator_steps.rb +1 -0
- data/examples/i18n/en/features/step_definitons/calculator_steps.rb +1 -0
- data/examples/i18n/es/features/step_definitons/calculador_steps.rb +1 -0
- data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +1 -0
- data/examples/i18n/fr/features/addition.feature +13 -11
- data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +6 -2
- data/examples/i18n/id/features/step_definitons/calculator_steps.rb +1 -0
- data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +1 -0
- data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +2 -0
- data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +1 -0
- data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +1 -0
- data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +1 -0
- data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +1 -0
- data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +1 -0
- data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +1 -0
- data/examples/selenium/features/search.feature +1 -1
- data/examples/selenium/features/step_definitons/stories_steps.rb +2 -3
- data/examples/tickets/features/lib/eatting_machine.rb +18 -0
- data/examples/tickets/features/lib/pantry.rb +20 -0
- data/examples/tickets/features/scenario_outline.feature +64 -0
- data/examples/tickets/features/step_definitons/scenario_outline_steps.rb +34 -0
- data/examples/tickets/features/step_definitons/tickets_steps.rb +4 -0
- data/gem_tasks/fix_cr_lf.rake +1 -1
- data/gem_tasks/yard.rake +8 -0
- data/lib/autotest/cucumber_mixin.rb +3 -3
- data/lib/cucumber.rb +2 -0
- data/lib/cucumber/broadcaster.rb +1 -1
- data/lib/cucumber/cli.rb +87 -42
- data/lib/cucumber/core_ext/exception.rb +20 -0
- data/lib/cucumber/core_ext/string.rb +1 -1
- data/lib/cucumber/executor.rb +35 -18
- data/lib/cucumber/formatters/ansicolor.rb +65 -74
- data/lib/cucumber/formatters/html_formatter.rb +33 -10
- data/lib/cucumber/formatters/pretty_formatter.rb +58 -16
- data/lib/cucumber/formatters/progress_formatter.rb +3 -0
- data/lib/cucumber/formatters/unicode.rb +27 -0
- data/lib/cucumber/languages.yml +6 -4
- data/lib/cucumber/platform.rb +1 -0
- data/lib/cucumber/rails/world.rb +6 -6
- data/lib/cucumber/step_mother.rb +3 -0
- data/lib/cucumber/tree/feature.rb +28 -2
- data/lib/cucumber/tree/scenario.rb +62 -1
- data/lib/cucumber/tree/step.rb +32 -1
- data/lib/cucumber/treetop_parser/feature.treetop.erb +54 -7
- data/lib/cucumber/treetop_parser/feature_ar.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_cy.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_da.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_de.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_en-lol.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_en-tx.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_en.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_es.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_et.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_fr.rb +389 -30
- data/lib/cucumber/treetop_parser/feature_id.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_it.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_ja.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_lt.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_nl.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_no.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_pl.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_pt.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_ro.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_ro2.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_ru.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_se.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_zh-CN.rb +377 -18
- data/lib/cucumber/version.rb +1 -1
- data/lib/cucumber/world.rb +1 -0
- data/lib/cucumber/world/pending.rb +22 -0
- data/rails_generators/cucumber/templates/env.rb +1 -0
- data/rails_generators/feature/feature_generator.rb +22 -2
- data/rails_generators/feature/templates/feature.erb +15 -12
- data/rails_generators/feature/templates/steps.erb +16 -14
- data/spec/cucumber/cli_spec.rb +87 -6
- data/spec/cucumber/executor_spec.rb +102 -30
- data/spec/cucumber/formatters/ansicolor_spec.rb +10 -10
- data/spec/cucumber/formatters/html_formatter_spec.rb +30 -0
- data/spec/cucumber/formatters/pretty_formatter_spec.rb +139 -4
- data/spec/cucumber/formatters/progress_formatter_spec.rb +16 -0
- data/spec/cucumber/tree/feature_spec.rb +84 -5
- data/spec/cucumber/tree/row_scenario_outline_spec.rb +73 -0
- data/spec/cucumber/tree/row_step_outline_spec.rb +38 -0
- data/spec/cucumber/tree/scenario_outline_spec.rb +50 -0
- data/spec/cucumber/tree/step_outline_spec.rb +17 -0
- data/spec/cucumber/tree/step_spec.rb +9 -0
- data/spec/cucumber/treetop_parser/empty_scenario_outline.feature +3 -0
- data/spec/cucumber/treetop_parser/feature_parser_spec.rb +22 -0
- data/spec/cucumber/treetop_parser/invalid_scenario_outlines.feature +7 -0
- data/spec/cucumber/treetop_parser/scenario_outline.feature +16 -0
- data/spec/cucumber/world/pending_spec.rb +46 -0
- data/spec/spec_helper.rb +2 -1
- metadata +19 -4
- data/TODO.txt +0 -26
data/lib/cucumber/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
%w{pending}.each{|f| require "cucumber/world/#{f}"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Cucumber
|
2
|
+
module World
|
3
|
+
module Pending
|
4
|
+
|
5
|
+
##
|
6
|
+
# Mark this step as pending
|
7
|
+
def pending(message = "TODO")
|
8
|
+
if block_given?
|
9
|
+
begin
|
10
|
+
yield
|
11
|
+
rescue Exception => e
|
12
|
+
raise Cucumber::ForcedPending.new(message)
|
13
|
+
end
|
14
|
+
raise Cucumber::ForcedPending.new("Expected pending '#{message}' to fail. No Error was raised.")
|
15
|
+
else
|
16
|
+
raise Cucumber::ForcedPending.new(message)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
ENV["RAILS_ENV"] = "test"
|
3
3
|
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
|
4
4
|
require 'cucumber/rails/world'
|
5
|
+
require 'cucumber/formatters/unicode' # Comment out this line if you don't want Cucumber Unicode support
|
5
6
|
Cucumber::Rails.use_transactional_fixtures
|
6
7
|
|
7
8
|
require 'webrat/rails'
|
@@ -8,9 +8,29 @@ class FeatureGenerator < Rails::Generator::NamedBase
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
|
11
|
+
class NamedArg
|
12
|
+
attr_reader :name
|
13
|
+
|
14
|
+
def initialize(s)
|
15
|
+
@name, @type = *s.split(':')
|
16
|
+
end
|
17
|
+
|
18
|
+
def value(n)
|
19
|
+
if @type == 'boolean'
|
20
|
+
(n % 2) == 0
|
21
|
+
else
|
22
|
+
"#{@name} #{n}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def named_args
|
28
|
+
args.map{|arg| NamedArg.new(arg)}
|
29
|
+
end
|
30
|
+
|
31
|
+
protected
|
12
32
|
|
13
33
|
def banner
|
14
34
|
"Usage: #{$0} feature ModelName [field:type, field:type]"
|
15
35
|
end
|
16
|
-
end
|
36
|
+
end
|
@@ -6,23 +6,26 @@ Feature: Manage <%= plural_name %>
|
|
6
6
|
Scenario: Register new <%= singular_name %>
|
7
7
|
Given I am on the new <%= singular_name %> page
|
8
8
|
<% keyword = 'When' -%>
|
9
|
-
<%
|
10
|
-
<%= keyword %> I fill in "<%= arg.humanize %>" with "
|
9
|
+
<% named_args.each do |arg| -%>
|
10
|
+
<%= keyword %> I fill in "<%= arg.name.humanize %>" with "<%= arg.value(1) %>"
|
11
11
|
<% keyword = 'And' -%>
|
12
12
|
<% end -%>
|
13
13
|
And I press "Create"
|
14
14
|
<% keyword = 'Then' -%>
|
15
|
-
<%
|
16
|
-
<%= keyword %> I should see "
|
15
|
+
<% named_args.each do |arg| -%>
|
16
|
+
<%= keyword %> I should see "<%= arg.value(1) %>"
|
17
17
|
<% keyword = 'And' -%>
|
18
18
|
<% end -%>
|
19
19
|
|
20
20
|
Scenario: Delete <%= singular_name %>
|
21
|
-
Given
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
Given the following <%= plural_name %>:
|
22
|
+
|<%= named_args.map(&:name).join('|') %>|
|
23
|
+
<% (1..4).each do |n| -%>
|
24
|
+
|<%= named_args.map{|arg| arg.value(n)}.join('|') %>|
|
25
|
+
<% end -%>
|
26
|
+
When I delete the 3rd <%= singular_name %>
|
27
|
+
Then I should see the following <%= plural_name %>:
|
28
|
+
|<%= named_args.map(&:name).join('|') %>|
|
29
|
+
<% [1,2,4].each do |n| -%>
|
30
|
+
|<%= named_args.map{|arg| arg.value(n)}.join('|') %>|
|
31
|
+
<% end -%>
|
@@ -1,22 +1,24 @@
|
|
1
1
|
Given /I am on the new <%= singular_name %> page/ do
|
2
|
-
|
2
|
+
visit "/<%= plural_name %>/new"
|
3
3
|
end
|
4
4
|
|
5
|
-
Given
|
6
|
-
<%= class_name %>.
|
7
|
-
<%= class_name %>.destroy_all
|
8
|
-
n.to_i.times do |n|
|
9
|
-
<%= class_name %>.create! :name => "<%= class_name %> #{n}"
|
10
|
-
end
|
11
|
-
end
|
5
|
+
Given /^the following <%= plural_name %>:$/ do |<%= plural_name %>|
|
6
|
+
<%= class_name %>.create!(<%= plural_name %>.hashes)
|
12
7
|
end
|
13
8
|
|
14
|
-
When
|
15
|
-
|
16
|
-
|
9
|
+
When /^I delete the (\d+)(?:st|nd|rd|th) <%= singular_name %>$/ do |pos|
|
10
|
+
visit <%= plural_name %>_url
|
11
|
+
within("table > tr:nth-child(#{pos.to_i+1})") do
|
12
|
+
click_link "Destroy"
|
13
|
+
end
|
17
14
|
end
|
18
15
|
|
19
|
-
Then
|
20
|
-
<%=
|
21
|
-
|
16
|
+
Then /^I should see the following <%= plural_name %>:$/ do |<%= plural_name %>|
|
17
|
+
<%= plural_name %>.raw[1..-1].each_with_index do |row, i|
|
18
|
+
row.each_with_index do |cell, j|
|
19
|
+
response.should have_selector("table > tr:nth-child(#{i+2}) > td:nth-child(#{j+1})") { |td|
|
20
|
+
td.inner_text.should == cell
|
21
|
+
}
|
22
|
+
end
|
23
|
+
end
|
22
24
|
end
|
data/spec/cucumber/cli_spec.rb
CHANGED
@@ -17,12 +17,12 @@ module Cucumber
|
|
17
17
|
end
|
18
18
|
|
19
19
|
before(:each) do
|
20
|
-
Kernel.stub!(:exit)
|
20
|
+
Kernel.stub!(:exit).and_return(nil)
|
21
21
|
end
|
22
22
|
|
23
|
-
def given_cucumber_yml_defined_as(
|
23
|
+
def given_cucumber_yml_defined_as(hash_or_string)
|
24
24
|
File.stub!(:exist?).and_return(true)
|
25
|
-
cucumber_yml =
|
25
|
+
cucumber_yml = hash_or_string.is_a?(Hash) ? hash_or_string.to_yaml : hash_or_string
|
26
26
|
IO.stub!(:read).with('cucumber.yml').and_return(cucumber_yml)
|
27
27
|
end
|
28
28
|
|
@@ -73,6 +73,18 @@ Defined profiles in cucumber.yml:
|
|
73
73
|
error.string.should == "Profiles must be defined as a String. The 'foo' profile was [1, 2, 3] (Array).\n"
|
74
74
|
end
|
75
75
|
|
76
|
+
it "should provide a helpful error message when a specified profile exists but is nil or blank" do
|
77
|
+
[nil, ' '].each do |bad_input|
|
78
|
+
cli = CLI.new(StringIO.new, error = StringIO.new)
|
79
|
+
|
80
|
+
given_cucumber_yml_defined_as({'foo' => bad_input})
|
81
|
+
|
82
|
+
cli.parse_options!(%w{--profile foo})
|
83
|
+
|
84
|
+
error.string.should match(/The 'foo' profile in cucumber.yml was blank. Please define the command line arguments for the 'foo' profile in cucumber.yml./)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
76
88
|
it "should provide a helpful error message when no YAML file exists and a profile is specified" do
|
77
89
|
cli = CLI.new(StringIO.new, error = StringIO.new)
|
78
90
|
|
@@ -80,7 +92,32 @@ Defined profiles in cucumber.yml:
|
|
80
92
|
|
81
93
|
cli.parse_options!(%w{--profile i_do_not_exist})
|
82
94
|
|
83
|
-
error.string.should match(/cucumber.yml was not found. Please
|
95
|
+
error.string.should match(/cucumber.yml was not found. Please refer to cucumber's documentaion on defining profiles in cucumber.yml./)
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should provide a helpful error message when cucumber.yml is blank or malformed" do
|
99
|
+
expected_error_message = /cucumber.yml was found, but was blank or malformed. Please refer to cucumber's documentaion on correct profile usage./
|
100
|
+
|
101
|
+
['', 'sfsadfs', "--- \n- an\n- array\n", "---dddfd"].each do |bad_input|
|
102
|
+
cli = CLI.new(StringIO.new, error = StringIO.new)
|
103
|
+
|
104
|
+
given_cucumber_yml_defined_as(bad_input)
|
105
|
+
cli.parse_options!([])
|
106
|
+
|
107
|
+
error.string.should match(expected_error_message)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should procide a helpful error message when the YAML can not be parsed" do
|
112
|
+
expected_error_message = /cucumber.yml was found, but could not be parsed. Please refer to cucumber's documentaion on correct profile usage./
|
113
|
+
cli = CLI.new(StringIO.new, error = StringIO.new)
|
114
|
+
|
115
|
+
given_cucumber_yml_defined_as("input that causes an exception in YAML loading")
|
116
|
+
YAML.should_receive(:load).and_raise Exception
|
117
|
+
|
118
|
+
cli.parse_options!([])
|
119
|
+
|
120
|
+
error.string.should match(expected_error_message)
|
84
121
|
end
|
85
122
|
|
86
123
|
it "should accept --no-source option" do
|
@@ -112,6 +149,21 @@ Defined profiles in cucumber.yml:
|
|
112
149
|
cli.options[:verbose].should be_true
|
113
150
|
end
|
114
151
|
|
152
|
+
it "should require files in support paths first" do
|
153
|
+
File.stub!(:directory?).and_return(true)
|
154
|
+
Dir.stub!(:[]).and_return(["/features/step_definitions/foo.rb","/features/support/env.rb"])
|
155
|
+
|
156
|
+
cli = CLI.new(StringIO.new)
|
157
|
+
cli.parse_options!(%w{--require /features})
|
158
|
+
|
159
|
+
cli.should_receive(:require).twice.with(/treetop_parser/).ordered
|
160
|
+
cli.should_receive(:require).with("/features/support/env.rb").ordered
|
161
|
+
cli.should_receive(:require).with("/features/step_definitions/foo.rb").ordered
|
162
|
+
cli.should_receive(:require).with("spec/expectations/differs/default").ordered
|
163
|
+
|
164
|
+
cli.execute!(stub('step mother'), mock_executor, mock_features)
|
165
|
+
end
|
166
|
+
|
115
167
|
describe "verbose mode" do
|
116
168
|
|
117
169
|
before(:each) do
|
@@ -384,6 +436,36 @@ Defined profiles in cucumber.yml:
|
|
384
436
|
cli.execute!(stub('step mother'), mock_executor, stub('features'))
|
385
437
|
end
|
386
438
|
|
439
|
+
describe "--backtrace" do
|
440
|
+
before do
|
441
|
+
Exception.cucumber_full_backtrace = false
|
442
|
+
end
|
443
|
+
|
444
|
+
it "should show full backtrace when --backtrace is present" do
|
445
|
+
cli = CLI.new
|
446
|
+
cli.parse_options!(['--backtrace'])
|
447
|
+
begin
|
448
|
+
"x".should == "y"
|
449
|
+
rescue => e
|
450
|
+
e.cucumber_backtrace[0].should_not == "#{__FILE__}:#{__LINE__ - 2}"
|
451
|
+
end
|
452
|
+
end
|
453
|
+
|
454
|
+
it "should strip gems when --backtrace is absent" do
|
455
|
+
cli = CLI.new
|
456
|
+
cli.parse_options!(['--'])
|
457
|
+
begin
|
458
|
+
"x".should == "y"
|
459
|
+
rescue => e
|
460
|
+
e.cucumber_backtrace[0].should == "#{__FILE__}:#{__LINE__ - 2}"
|
461
|
+
end
|
462
|
+
end
|
463
|
+
|
464
|
+
after do
|
465
|
+
Exception.cucumber_full_backtrace = false
|
466
|
+
end
|
467
|
+
end
|
468
|
+
|
387
469
|
describe "example.feature:line file arguments" do
|
388
470
|
|
389
471
|
it "should extract line numbers" do
|
@@ -413,8 +495,7 @@ Defined profiles in cucumber.yml:
|
|
413
495
|
|
414
496
|
cli.options[:lines_for_features].should == {'example.feature' => [11, 12]}
|
415
497
|
end
|
416
|
-
|
417
|
-
end
|
498
|
+
end
|
418
499
|
|
419
500
|
it "should search for all features in the specified directory" do
|
420
501
|
cli = CLI.new
|
@@ -10,10 +10,24 @@ module Cucumber
|
|
10
10
|
:name => 'test',
|
11
11
|
:accept => nil,
|
12
12
|
:steps => [],
|
13
|
-
:pending? => true
|
13
|
+
:pending? => true,
|
14
|
+
:outline? => false,
|
14
15
|
}.merge(stubs))
|
15
16
|
end
|
16
17
|
|
18
|
+
def parse_features(feature_file)
|
19
|
+
parser = TreetopParser::FeatureParser.new
|
20
|
+
feature = parser.parse_feature(feature_file)
|
21
|
+
end
|
22
|
+
|
23
|
+
before do
|
24
|
+
::Term::ANSIColor.coloring = false
|
25
|
+
end
|
26
|
+
|
27
|
+
after do
|
28
|
+
::Term::ANSIColor.coloring = true
|
29
|
+
end
|
30
|
+
|
17
31
|
before do # TODO: Way more setup and duplication of lib code. Use lib code!
|
18
32
|
@io = StringIO.new
|
19
33
|
@step_mother = StepMother.new
|
@@ -21,9 +35,8 @@ module Cucumber
|
|
21
35
|
@formatters = Broadcaster.new [Formatters::ProgressFormatter.new(@io)]
|
22
36
|
@executor.formatters = @formatters
|
23
37
|
@feature_file = File.dirname(__FILE__) + '/sell_cucumbers.feature'
|
24
|
-
@
|
25
|
-
@
|
26
|
-
@feature = @parser.parse_feature(@feature_file)
|
38
|
+
@features = features = Tree::Features.new
|
39
|
+
@feature = parse_features(@feature_file)
|
27
40
|
@features << @feature
|
28
41
|
end
|
29
42
|
|
@@ -46,7 +59,7 @@ module Cucumber
|
|
46
59
|
|
47
60
|
1)
|
48
61
|
dang
|
49
|
-
#{__FILE__}:
|
62
|
+
#{__FILE__}:56:in `Then /I should owe (\\d*) cucumbers/'
|
50
63
|
#{@feature_file}:9:in `Then I should owe 7 cucumbers'
|
51
64
|
})
|
52
65
|
end
|
@@ -75,6 +88,13 @@ dang
|
|
75
88
|
world.doit.should == "dunit"
|
76
89
|
world.beatit.should == "beatenit"
|
77
90
|
end
|
91
|
+
|
92
|
+
it "should add support for calling 'pending' from world" do
|
93
|
+
world = @executor.create_world
|
94
|
+
|
95
|
+
world.should respond_to(:pending)
|
96
|
+
end
|
97
|
+
|
78
98
|
end
|
79
99
|
|
80
100
|
describe "visiting feature" do
|
@@ -162,6 +182,54 @@ dang
|
|
162
182
|
end
|
163
183
|
|
164
184
|
end
|
185
|
+
|
186
|
+
describe "visiting step outline" do
|
187
|
+
|
188
|
+
it "should trace step" do
|
189
|
+
mock_formatter = mock('formatter')
|
190
|
+
@executor.formatters = mock_formatter
|
191
|
+
mock_step_outline = mock('step outline', :regexp_args_proc => [])
|
192
|
+
|
193
|
+
mock_formatter.should_receive(:step_traced)
|
194
|
+
|
195
|
+
@executor.visit_step_outline(mock_step_outline)
|
196
|
+
end
|
197
|
+
|
198
|
+
end
|
199
|
+
|
200
|
+
describe "visit forced pending step" do
|
201
|
+
|
202
|
+
before(:each) do
|
203
|
+
@executor.formatters = mock('formatter', :null_object => true)
|
204
|
+
end
|
205
|
+
|
206
|
+
it "should store the pending exception with the step" do
|
207
|
+
mock_step = mock("mock step", :regexp_args_proc => nil)
|
208
|
+
pending_exception = ForcedPending.new("implement me")
|
209
|
+
mock_step.stub!(:execute_in).and_raise(pending_exception)
|
210
|
+
|
211
|
+
mock_step.should_receive(:'error=').with(pending_exception)
|
212
|
+
|
213
|
+
@executor.visit_step(mock_step)
|
214
|
+
end
|
215
|
+
|
216
|
+
describe "after failed/pending step" do
|
217
|
+
|
218
|
+
it "should store the pending exception with the step" do
|
219
|
+
mock_step_1 = mock("mock step", :null_object => true)
|
220
|
+
mock_step_2 = mock("mock step", :regexp_args_proc => nil)
|
221
|
+
pending_exception = ForcedPending.new("implement me")
|
222
|
+
mock_step_1.stub!(:execute_in).and_raise(StandardError)
|
223
|
+
mock_step_2.stub!(:execute_in).and_raise(pending_exception)
|
224
|
+
|
225
|
+
mock_step_2.should_receive(:'error=').with(pending_exception)
|
226
|
+
|
227
|
+
@executor.visit_step(mock_step_1)
|
228
|
+
@executor.visit_step(mock_step_2)
|
229
|
+
end
|
230
|
+
|
231
|
+
end
|
232
|
+
end
|
165
233
|
|
166
234
|
describe "visiting row scenarios" do
|
167
235
|
|
@@ -175,40 +243,44 @@ dang
|
|
175
243
|
}.merge(stubs))
|
176
244
|
end
|
177
245
|
|
178
|
-
|
179
|
-
|
246
|
+
%w{regular_scenario scenario_outline}.each do |regular_or_outline|
|
247
|
+
|
180
248
|
before(:each) do
|
181
|
-
@
|
249
|
+
@scenario = mock("#{regular_or_outline} scenario", :name => 'test', :at_line? => true, :pending? => false, :accept => nil)
|
250
|
+
|
182
251
|
@executor.lines_for_features = Hash.new([5])
|
183
|
-
@executor.
|
252
|
+
@executor.send("visit_#{regular_or_outline}".to_sym, @scenario)
|
184
253
|
end
|
254
|
+
|
255
|
+
describe "without having first run the matching #{regular_or_outline}" do
|
185
256
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
@executor.visit_row_scenario(row_scenario)
|
191
|
-
end
|
257
|
+
it "should run the #{regular_or_outline} before the row scenario" do
|
258
|
+
@scenario.should_receive(:accept)
|
259
|
+
row_scenario = mock_row_scenario(:name => 'test', :at_line? => true)
|
260
|
+
row_scenario.should_receive(:accept)
|
192
261
|
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
262
|
+
@executor.visit_row_scenario(row_scenario)
|
263
|
+
end
|
264
|
+
|
265
|
+
it "should run the row scenario after running the #{regular_or_outline}" do
|
266
|
+
row_scenario = mock_row_scenario(:at_line? => true)
|
267
|
+
row_scenario.should_receive(:accept)
|
268
|
+
@scenario.stub!(:accept)
|
200
269
|
|
201
|
-
|
270
|
+
@executor.visit_row_scenario(row_scenario)
|
271
|
+
end
|
202
272
|
|
203
|
-
|
204
|
-
scenario = Tree::Scenario.new(nil, 'test', 1)
|
205
|
-
@executor.visit_regular_scenario(scenario)
|
273
|
+
end
|
206
274
|
|
207
|
-
|
275
|
+
describe "having run matching #{regular_or_outline}" do
|
276
|
+
|
277
|
+
it "should not run the regular scenario if it has already run" do
|
278
|
+
@scenario.should_not_receive(:accept)
|
208
279
|
|
209
|
-
|
210
|
-
|
280
|
+
@executor.visit_row_scenario(mock_row_scenario(:name => 'test', :at_line? => true, :accept => nil))
|
281
|
+
end
|
211
282
|
|
283
|
+
end
|
212
284
|
end
|
213
285
|
end
|
214
286
|
|
@@ -293,6 +365,6 @@ dang
|
|
293
365
|
@executor.visit_features(@features)
|
294
366
|
end
|
295
367
|
end
|
296
|
-
|
368
|
+
|
297
369
|
end
|
298
370
|
end
|