aslakhellesoy-cucumber 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- 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/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/pending.rb +22 -0
- data/lib/cucumber/world.rb +1 -0
- data/lib/cucumber.rb +2 -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
@@ -4,6 +4,16 @@ module Cucumber
|
|
4
4
|
module Tree
|
5
5
|
describe Feature do
|
6
6
|
|
7
|
+
def mock_scenario(stubs = {})
|
8
|
+
mock("scenario", {:update_table_column_widths => nil,
|
9
|
+
:outline? => false,
|
10
|
+
:table_header= => nil}.merge(stubs))
|
11
|
+
end
|
12
|
+
|
13
|
+
def mock_scenario_outline(stubs = {})
|
14
|
+
mock_scenario({:outline? => true, :row? => false, :table_header= => nil}.merge(stubs))
|
15
|
+
end
|
16
|
+
|
7
17
|
it "should have padding_length 2 when alone" do
|
8
18
|
feature = Feature.new('header')
|
9
19
|
feature.padding_length.should == 2
|
@@ -14,30 +24,99 @@ module Cucumber
|
|
14
24
|
it "should create a new scenario for a feature" do
|
15
25
|
feature = Feature.new('header')
|
16
26
|
|
17
|
-
Scenario.should_receive(:new).with(feature, 'test scenario', "
|
27
|
+
Scenario.should_receive(:new).with(feature, 'test scenario', "29")
|
18
28
|
|
19
29
|
feature.Scenario('test scenario') {}
|
20
30
|
end
|
21
31
|
|
22
32
|
end
|
23
33
|
|
34
|
+
describe "creating a Scenario Outline" do
|
35
|
+
|
36
|
+
it "should create a new scenario outline for feature" do
|
37
|
+
feature = Feature.new('header')
|
38
|
+
|
39
|
+
ScenarioOutline.should_receive(:new).with(feature, 'test', '41')
|
40
|
+
|
41
|
+
feature.ScenarioOutline('test') {}
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
24
46
|
describe "creating a Table" do
|
47
|
+
|
48
|
+
before(:each) do
|
49
|
+
@feature = Feature.new('header')
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "previous scenario is a scenario outline" do
|
53
|
+
|
54
|
+
it "should create a row scenario outline for feature" do
|
55
|
+
mock_scenario_outline = mock_scenario_outline(:outline? => true)
|
56
|
+
Scenario.stub!(:new).and_return(mock_scenario_outline)
|
57
|
+
@feature.add_scenario('scenario', 5)
|
58
|
+
|
59
|
+
RowScenarioOutline.should_receive(:new).with(@feature, mock_scenario_outline, ['1', '2'], anything)
|
60
|
+
|
61
|
+
@feature.Table do |t|
|
62
|
+
t | "input_1" | "input_2" | t
|
63
|
+
t | 1 | 2 | t
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "previous scenario was a regular scenario" do
|
70
|
+
|
71
|
+
it "should create a row scenario for feature" do
|
72
|
+
mock_scenario = mock_scenario(:outline? => false)
|
73
|
+
Scenario.stub!(:new).and_return(mock_scenario)
|
74
|
+
@feature.add_scenario('scenario', 5)
|
75
|
+
|
76
|
+
RowScenario.should_receive(:new).with(@feature, mock_scenario, ['1', '2'], anything)
|
77
|
+
|
78
|
+
@feature.Table do |t|
|
79
|
+
t | "input_1" | "input_2" | t
|
80
|
+
t | 1 | 2 | t
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
25
85
|
|
26
86
|
it "should set the table header of the template scenario" do
|
27
|
-
|
28
|
-
mock_scenario = mock("scenario", :update_table_column_widths => nil)
|
87
|
+
mock_scenario = mock("scenario", :update_table_column_widths => nil, :outline? => false)
|
29
88
|
Scenario.stub!(:new).and_return(mock_scenario)
|
30
|
-
feature.add_scenario('scenario', 5)
|
89
|
+
@feature.add_scenario('scenario', 5)
|
31
90
|
|
32
91
|
mock_scenario.should_receive(:table_header=).with(["input_1", "input_2"])
|
33
92
|
|
34
|
-
feature.Table do |t|
|
93
|
+
@feature.Table do |t|
|
35
94
|
t | "input_1" | "input_2" | t
|
36
95
|
t | 1 | 2 | t
|
37
96
|
end
|
38
97
|
end
|
39
98
|
|
40
99
|
end
|
100
|
+
|
101
|
+
it "should create a new row scenario outline" do
|
102
|
+
feature = Feature.new('header')
|
103
|
+
|
104
|
+
RowScenarioOutline.should_receive(:new)
|
105
|
+
|
106
|
+
feature.add_row_scenario_outline(mock_scenario_outline, [], 1)
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should visit scenario outline" do
|
110
|
+
feature = Feature.new('header')
|
111
|
+
ScenarioOutline.stub!(:new).and_return(mock_scenario_outline(:outline? => true, :row? => false))
|
112
|
+
feature.add_scenario_outline(nil, nil)
|
113
|
+
mock_visitor = mock('visitor', :visit_header => nil)
|
114
|
+
|
115
|
+
mock_visitor.should_receive(:visit_scenario_outline)
|
116
|
+
|
117
|
+
feature.accept(mock_visitor)
|
118
|
+
end
|
119
|
+
|
41
120
|
end
|
42
121
|
end
|
43
122
|
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
module Cucumber
|
4
|
+
module Tree
|
5
|
+
describe RowScenarioOutline do
|
6
|
+
|
7
|
+
def mock_feature
|
8
|
+
mock_feature = mock("feature")
|
9
|
+
end
|
10
|
+
|
11
|
+
def mock_scenario(stubs ={})
|
12
|
+
mock("scenario", {:update_table_column_widths => nil}.merge(stubs))
|
13
|
+
end
|
14
|
+
|
15
|
+
def mock_step(stubs = {})
|
16
|
+
mock("step", {:arity => 0}.merge(stubs))
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should indicate scenario is a scenario outline" do
|
20
|
+
outline = RowScenarioOutline.new(mock_feature, mock_scenario, [], 1)
|
21
|
+
|
22
|
+
outline.should be_a_outline
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "steps" do
|
26
|
+
|
27
|
+
it "should create a new step with placeholders in template scenario steps replaced with values from scenario row" do
|
28
|
+
mock_step = mock_step(:keyword => 'Given', :name => '<animal> burning bright')
|
29
|
+
mock_scenario = mock_scenario(:table_header => ["animal"], :steps => [mock_step] )
|
30
|
+
outline = RowScenarioOutline.new(mock_feature, mock_scenario, ["tiger"], 1)
|
31
|
+
|
32
|
+
RowStepOutline.should_receive(:new).with(outline, mock_step, 'tiger burning bright', ["tiger"], 1)
|
33
|
+
|
34
|
+
outline.steps
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should leave the scenario template's name unchanged when replacing placeholders" do
|
38
|
+
mock_step = mock_step(:keyword => 'Given', :name => '<animal> burning bright', :extra_args => [])
|
39
|
+
mock_scenario = mock_scenario(:table_header => ["animal"], :steps => [mock_step] )
|
40
|
+
outline = RowScenarioOutline.new(mock_feature, mock_scenario, ["tiger"], 1)
|
41
|
+
|
42
|
+
outline.steps
|
43
|
+
|
44
|
+
mock_step.name.should == '<animal> burning bright'
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should leave the step name untouched if it has no placeholders" do
|
48
|
+
mock_step = mock_step(:keyword => 'Given', :name => 'beauty too rich for earth too dear')
|
49
|
+
mock_scenario = mock_scenario(:table_header => ["animal"], :steps => [mock_step] )
|
50
|
+
outline = RowScenarioOutline.new(mock_feature, mock_scenario, ["tiger"], 1)
|
51
|
+
|
52
|
+
RowStepOutline.should_receive(:new).with(outline, mock_step, 'beauty too rich for earth too dear', [], 1)
|
53
|
+
|
54
|
+
outline.steps
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should ensure that created steps do not contain values already used in previous steps" do
|
58
|
+
mock_step_1 = mock_step(:keyword => 'Given', :name => '<animal> eating')
|
59
|
+
mock_step_2 = mock_step(:keyword => 'Given', :name => 'eating <animal>')
|
60
|
+
mock_scenario = mock_scenario(:table_header => ["animal"], :steps => [mock_step_1, mock_step_2] )
|
61
|
+
outline = RowScenarioOutline.new(mock_feature, mock_scenario, ["tiger"], 1)
|
62
|
+
|
63
|
+
RowStepOutline.should_receive(:new).with(anything, anything, anything, ['tiger'], anything)
|
64
|
+
RowStepOutline.should_receive(:new).with(anything, anything, anything, [], anything)
|
65
|
+
|
66
|
+
outline.steps
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
module Cucumber
|
4
|
+
module Tree
|
5
|
+
describe RowStepOutline do
|
6
|
+
|
7
|
+
def mock_step(stubs = {})
|
8
|
+
mock("step", {:extra_args => []}.merge(stubs))
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
it "should be a outline" do
|
13
|
+
outline_row = RowStepOutline.new(mock("scenario"), mock_step, 'outline', [], 1)
|
14
|
+
|
15
|
+
outline_row.should be_a_outline
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should be a row step" do
|
19
|
+
outline_row = RowStepOutline.new(mock("scenario"), mock_step, 'outline', [], 1)
|
20
|
+
|
21
|
+
outline_row.should be_a_row
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should have visible args" do
|
25
|
+
outline_row = RowStepOutline.new(mock("scenario"), mock_step, 'outline', ["tiger", "night"], 1)
|
26
|
+
|
27
|
+
outline_row.visible_args.should == ["tiger", "night"]
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should have extra args" do
|
31
|
+
outline_row = RowStepOutline.new(mock("scenario"), mock_step(:extra_args => ["extra", "arrrgs"]), 'outline', [], 1)
|
32
|
+
|
33
|
+
outline_row.extra_args.should == ["extra", "arrrgs"]
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
module Cucumber
|
4
|
+
module Tree
|
5
|
+
describe ScenarioOutline do
|
6
|
+
|
7
|
+
def mock_feature
|
8
|
+
mock_feature = mock("feature")
|
9
|
+
end
|
10
|
+
|
11
|
+
def mock_scenario(stubs ={})
|
12
|
+
mock("scenario", {:update_table_column_widths => nil}.merge(stubs))
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should indicate its a scenario outline" do
|
16
|
+
scenario_outline = ScenarioOutline.new(mock_feature, '', 1)
|
17
|
+
|
18
|
+
scenario_outline.should be_a_outline
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should create a step outline when adding new steps" do
|
22
|
+
scenario_outline = ScenarioOutline.new(mock_feature, '', 1)
|
23
|
+
|
24
|
+
StepOutline.should_receive(:new)
|
25
|
+
|
26
|
+
scenario_outline.create_step('Given', '', 2)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should visit step outlines" do
|
30
|
+
outline = ScenarioOutline.new(mock_feature, '', 1)
|
31
|
+
outline.create_step('Given', '', 1)
|
32
|
+
mock_visitor = mock('visitor')
|
33
|
+
|
34
|
+
mock_visitor.should_receive(:visit_step_outline)
|
35
|
+
|
36
|
+
outline.accept(mock_visitor)
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should include indent when padding to step" do
|
40
|
+
scenario = ScenarioOutline.new(mock_feature, '', 1)
|
41
|
+
scenario.create_step('Given', 'a longish step', 1)
|
42
|
+
|
43
|
+
#Scenario Outline: ****
|
44
|
+
# Given a longish step
|
45
|
+
scenario.padding_length.should == 4 + Scenario::INDENT
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
module Cucumber
|
4
|
+
module Tree
|
5
|
+
describe StepOutline do
|
6
|
+
|
7
|
+
it "should be a outline" do
|
8
|
+
step_outline = StepOutline.new(mock("scenario"), 'Given', 'outline', 1)
|
9
|
+
|
10
|
+
step_outline.should be_a_outline
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
|
@@ -43,6 +43,15 @@ module Cucumber
|
|
43
43
|
end
|
44
44
|
|
45
45
|
end
|
46
|
+
|
47
|
+
it "should indicate if a forced pending exception occured" do
|
48
|
+
scenario = Scenario.new(nil, '9', 1)
|
49
|
+
step = scenario.create_step('Given', '666666', 98)
|
50
|
+
|
51
|
+
step.instance_variable_set("@error", ForcedPending.new)
|
52
|
+
|
53
|
+
step.should be_forced_to_pending
|
54
|
+
end
|
46
55
|
|
47
56
|
end
|
48
57
|
end
|
@@ -67,6 +67,13 @@ module Cucumber
|
|
67
67
|
f.scenarios[2].should have(1).steps
|
68
68
|
end
|
69
69
|
|
70
|
+
it "should allow empty scenario outlines" do
|
71
|
+
p = FeatureParser.new
|
72
|
+
f = p.parse_feature(File.dirname(__FILE__) + '/empty_scenario_outline.feature')
|
73
|
+
|
74
|
+
f.scenarios[0].should have(0).steps
|
75
|
+
end
|
76
|
+
|
70
77
|
it "should allow multiple tables" do
|
71
78
|
p = FeatureParser.new
|
72
79
|
f = p.parse_feature(File.dirname(__FILE__) + '/multiple_tables.feature')
|
@@ -93,6 +100,21 @@ module Cucumber
|
|
93
100
|
step = f.scenarios[0].steps[3]
|
94
101
|
step.extra_args[0].should == "A string\n that \"indents\"\nand spans\nseveral lines\n"
|
95
102
|
end
|
103
|
+
|
104
|
+
it "should parse scenario outlines" do
|
105
|
+
p = FeatureParser.new
|
106
|
+
f = p.parse_feature(File.dirname(__FILE__) + '/scenario_outline.feature')
|
107
|
+
|
108
|
+
f.should have(4).scenarios
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should not allow a scenario outline with an example table but no steps" do
|
112
|
+
p = FeatureParser.new
|
113
|
+
lambda{
|
114
|
+
p.parse_feature(File.dirname(__FILE__) + '/invalid_scenario_outlines.feature')
|
115
|
+
}.should raise_error(Feature::SyntaxError)
|
116
|
+
end
|
117
|
+
|
96
118
|
end
|
97
119
|
end
|
98
120
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Feature: Valid Outlines
|
2
|
+
|
3
|
+
Scenario Outline: Joe fails to login
|
4
|
+
Given I login as Joe without the '<Privilege>' privilege
|
5
|
+
When I <Request Method> /admin/<Path>
|
6
|
+
Then I should see the text "Sorry Joe, you're not allowed to see <Path>"
|
7
|
+
|
8
|
+
Examples:
|
9
|
+
| Privilege | Request Method | Path |
|
10
|
+
| user | GET | reports |
|
11
|
+
| user | GET | managers |
|
12
|
+
|
13
|
+
Scenario Outline: Look at me ma no examples!
|
14
|
+
Given I login as Joe without the '<Privilege>' privilege
|
15
|
+
When I <Request Method> /admin/<Path>
|
16
|
+
Then I should see the text "Sorry Joe, you're not allowed to see <Path>"
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
module Cucumber
|
4
|
+
module World
|
5
|
+
describe Pending do
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
@world = Object.new
|
9
|
+
@world.extend(World::Pending)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should raise a ForcedPending if no block is supplied' do
|
13
|
+
lambda {
|
14
|
+
@world.pending "TODO"
|
15
|
+
}.should raise_error(ForcedPending, /TODO/)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should raise a ForcedPending if a supplied block fails as expected' do
|
19
|
+
lambda {
|
20
|
+
@world.pending "TODO" do
|
21
|
+
raise "oops"
|
22
|
+
end
|
23
|
+
}.should raise_error(ForcedPending, /TODO/)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should raise a ForcedPending if a supplied block fails as expected with a mock' do
|
27
|
+
lambda {
|
28
|
+
@world.pending "TODO" do
|
29
|
+
m = mock('thing')
|
30
|
+
m.should_receive(:foo)
|
31
|
+
m.rspec_verify
|
32
|
+
end
|
33
|
+
}.should raise_error(ForcedPending, /TODO/)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should raise a ForcedPending if a supplied block starts working' do
|
37
|
+
lambda {
|
38
|
+
@world.pending "TODO" do
|
39
|
+
# success!
|
40
|
+
end
|
41
|
+
}.should raise_error(ForcedPending, /TODO/)
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,13 +2,14 @@ require 'rubygems'
|
|
2
2
|
gem 'rspec'
|
3
3
|
require 'spec'
|
4
4
|
|
5
|
+
ENV['CUCUMBER_COLORS']=nil
|
5
6
|
$KCODE='u'
|
6
7
|
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
7
8
|
require 'cucumber'
|
8
9
|
require 'cucumber/treetop_parser/feature_en'
|
9
10
|
Cucumber.load_language('en')
|
10
11
|
|
11
|
-
::Term::ANSIColor.coloring =
|
12
|
+
::Term::ANSIColor.coloring = true
|
12
13
|
|
13
14
|
# Open up the tree classes a little for easier inspection.
|
14
15
|
module Cucumber
|
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.1.
|
4
|
+
version: 0.1.13
|
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: 2008-12-
|
12
|
+
date: 2008-12-20 00:00:00 -08:00
|
13
13
|
default_executable: cucumber
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -60,7 +60,6 @@ extra_rdoc_files:
|
|
60
60
|
- License.txt
|
61
61
|
- Manifest.txt
|
62
62
|
- README.txt
|
63
|
-
- TODO.txt
|
64
63
|
- examples/i18n/ja/README.txt
|
65
64
|
files:
|
66
65
|
- History.txt
|
@@ -68,7 +67,6 @@ files:
|
|
68
67
|
- Manifest.txt
|
69
68
|
- README.txt
|
70
69
|
- Rakefile
|
71
|
-
- TODO.txt
|
72
70
|
- bin/cucumber
|
73
71
|
- config/hoe.rb
|
74
72
|
- config/requirements.rb
|
@@ -171,6 +169,10 @@ files:
|
|
171
169
|
- examples/test_unit/features/test_unit.feature
|
172
170
|
- examples/tickets/Rakefile
|
173
171
|
- examples/tickets/cucumber.yml
|
172
|
+
- examples/tickets/features/lib/eatting_machine.rb
|
173
|
+
- examples/tickets/features/lib/pantry.rb
|
174
|
+
- examples/tickets/features/scenario_outline.feature
|
175
|
+
- examples/tickets/features/step_definitons/scenario_outline_steps.rb
|
174
176
|
- examples/tickets/features/step_definitons/tickets_steps.rb
|
175
177
|
- examples/tickets/features/tickets.feature
|
176
178
|
- examples/watir/Rakefile
|
@@ -186,6 +188,7 @@ files:
|
|
186
188
|
- gem_tasks/gemspec.rake
|
187
189
|
- gem_tasks/rspec.rake
|
188
190
|
- gem_tasks/treetop.rake
|
191
|
+
- gem_tasks/yard.rake
|
189
192
|
- lib/autotest/cucumber.rb
|
190
193
|
- lib/autotest/cucumber_mixin.rb
|
191
194
|
- lib/autotest/cucumber_rails.rb
|
@@ -195,6 +198,7 @@ files:
|
|
195
198
|
- lib/cucumber.rb
|
196
199
|
- lib/cucumber/broadcaster.rb
|
197
200
|
- lib/cucumber/cli.rb
|
201
|
+
- lib/cucumber/core_ext/exception.rb
|
198
202
|
- lib/cucumber/core_ext/proc.rb
|
199
203
|
- lib/cucumber/core_ext/string.rb
|
200
204
|
- lib/cucumber/executor.rb
|
@@ -208,6 +212,7 @@ files:
|
|
208
212
|
- lib/cucumber/formatters/pretty_formatter.rb
|
209
213
|
- lib/cucumber/formatters/profile_formatter.rb
|
210
214
|
- lib/cucumber/formatters/progress_formatter.rb
|
215
|
+
- lib/cucumber/formatters/unicode.rb
|
211
216
|
- lib/cucumber/languages.yml
|
212
217
|
- lib/cucumber/model.rb
|
213
218
|
- lib/cucumber/model/table.rb
|
@@ -251,6 +256,8 @@ files:
|
|
251
256
|
- lib/cucumber/treetop_parser/feature_se.rb
|
252
257
|
- lib/cucumber/treetop_parser/feature_zh-CN.rb
|
253
258
|
- lib/cucumber/version.rb
|
259
|
+
- lib/cucumber/world.rb
|
260
|
+
- lib/cucumber/world/pending.rb
|
254
261
|
- rails_generators/cucumber/USAGE
|
255
262
|
- rails_generators/cucumber/cucumber_generator.rb
|
256
263
|
- rails_generators/cucumber/templates/cucumber
|
@@ -289,19 +296,27 @@ files:
|
|
289
296
|
- spec/cucumber/sell_cucumbers.feature
|
290
297
|
- spec/cucumber/step_mother_spec.rb
|
291
298
|
- spec/cucumber/tree/feature_spec.rb
|
299
|
+
- spec/cucumber/tree/row_scenario_outline_spec.rb
|
292
300
|
- spec/cucumber/tree/row_scenario_spec.rb
|
301
|
+
- spec/cucumber/tree/row_step_outline_spec.rb
|
302
|
+
- spec/cucumber/tree/scenario_outline_spec.rb
|
293
303
|
- spec/cucumber/tree/scenario_spec.rb
|
304
|
+
- spec/cucumber/tree/step_outline_spec.rb
|
294
305
|
- spec/cucumber/tree/step_spec.rb
|
295
306
|
- spec/cucumber/treetop_parser/empty_feature.feature
|
296
307
|
- spec/cucumber/treetop_parser/empty_scenario.feature
|
308
|
+
- spec/cucumber/treetop_parser/empty_scenario_outline.feature
|
297
309
|
- spec/cucumber/treetop_parser/feature_parser_spec.rb
|
298
310
|
- spec/cucumber/treetop_parser/fit_scenario.feature
|
299
311
|
- spec/cucumber/treetop_parser/given_scenario.feature
|
312
|
+
- spec/cucumber/treetop_parser/invalid_scenario_outlines.feature
|
300
313
|
- spec/cucumber/treetop_parser/multiline_steps.feature
|
301
314
|
- spec/cucumber/treetop_parser/multiple_tables.feature
|
315
|
+
- spec/cucumber/treetop_parser/scenario_outline.feature
|
302
316
|
- spec/cucumber/treetop_parser/spaces.feature
|
303
317
|
- spec/cucumber/treetop_parser/test_dos.feature
|
304
318
|
- spec/cucumber/treetop_parser/with_comments.feature
|
319
|
+
- spec/cucumber/world/pending_spec.rb
|
305
320
|
- spec/spec.opts
|
306
321
|
- spec/spec_helper.rb
|
307
322
|
has_rdoc: true
|
data/TODO.txt
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
== FEATURES/PROBLEMS:
|
2
|
-
|
3
|
-
* TODO: OK Refactor: Extract explicit node classes with RDoc (for better API doc)
|
4
|
-
* TODO: OK Get rid of the compile method. Compile the parser in Rake.
|
5
|
-
* TODO: OK Make grammar support \r\n, \r and \n (Add some fixture features for that)
|
6
|
-
* TODO: OK Make grammar support indentation
|
7
|
-
* TODO: OK Make grammar be totally relaxed about narrative
|
8
|
-
* TODO: OK Add a yaml file for different languages
|
9
|
-
* TODO: OK Custom nodes for the syntax tree
|
10
|
-
* TODO: OK Actually execute the features
|
11
|
-
* TODO: Make rake run specs by default
|
12
|
-
* TODO: OK Make it work with pure ruby regexen
|
13
|
-
* TODO: OK Make it work with string steps
|
14
|
-
* TODO: bin/cucumber --require [dir|file|glob]* --language no --format [file]*
|
15
|
-
* TODO: OK Pending steps shold print a block of code that can be pasted into code
|
16
|
-
* TODO: cucumber --where "Some text from a step" that prints "__FILE__:__LINE__ (STEP PATTERN)"
|
17
|
-
* TODO: Customisable trace output (like javascriptlint)
|
18
|
-
* TODO: Experiment: Make $variables become @variables
|
19
|
-
* TODO: OK GivenScenario
|
20
|
-
* TODO: OK PureRuby
|
21
|
-
* Make two trees include accept mixin
|
22
|
-
* TODO: Call steps from steps
|
23
|
-
* TODO: i18n in ruby too
|
24
|
-
* TODO: Don't load any treetop files if no .feature files are found
|
25
|
-
* TODO: Summary prints execution time
|
26
|
-
* TODO: --nocolor option
|