cucumber 0.8.6 → 0.8.7
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/.rspec +1 -1
- data/Caliper.yml +4 -0
- data/History.txt +1557 -0
- data/LICENSE +1 -1
- data/README.rdoc +26 -0
- data/Rakefile +51 -5
- data/VERSION.yml +5 -0
- data/bin/cucumber +1 -7
- data/cucumber.gemspec +77 -3
- data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/he/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +7 -4
- data/examples/i18n/ro/features/suma.feature +11 -0
- data/examples/i18n/ru/features/division.feature +2 -2
- data/examples/i18n/tr/features/step_definitons/hesap_makinesi_adimlari.rb +3 -3
- data/examples/sinatra/features/support/env.rb +5 -2
- data/examples/v8/features/fibonacci.feature +1 -1
- data/examples/watir/features/step_definitions/search_steps.rb +1 -1
- data/features/announce.feature +164 -0
- data/features/around_hooks.feature +232 -0
- data/features/background.feature +95 -284
- data/features/bug_371.feature +32 -0
- data/features/bug_464.feature +16 -0
- data/features/bug_475.feature +42 -0
- data/features/bug_585_tab_indentation.feature +22 -0
- data/features/bug_600.feature +67 -0
- data/features/call_steps_from_stepdefs.feature +154 -0
- data/features/cucumber_cli.feature +591 -0
- data/features/cucumber_cli_outlines.feature +117 -0
- data/features/custom_formatter.feature +73 -3
- data/features/default_snippets.feature +42 -0
- data/features/diffing.feature +25 -0
- data/features/drb_server_integration.feature +174 -0
- data/features/exception_in_after_block.feature +127 -0
- data/features/exception_in_after_step_block.feature +104 -0
- data/features/exception_in_before_block.feature +98 -0
- data/features/exclude_files.feature +20 -0
- data/features/expand.feature +60 -0
- data/features/html_formatter.feature +8 -0
- data/features/html_formatter/a.html +582 -0
- data/features/json_formatter.feature +245 -160
- data/features/junit_formatter.feature +88 -0
- data/features/language_from_header.feature +30 -0
- data/features/language_help.feature +78 -0
- data/features/listener_debugger_formatter.feature +42 -0
- data/features/multiline_names.feature +44 -0
- data/features/negative_tagged_hooks.feature +60 -0
- data/features/post_configuration_hook.feature +37 -0
- data/features/profiles.feature +126 -0
- data/features/rake_task.feature +152 -0
- data/features/report_called_undefined_steps.feature +34 -0
- data/features/rerun_formatter.feature +45 -0
- data/features/simplest.feature +11 -0
- data/features/snippet.feature +23 -0
- data/features/snippets_when_using_star_keyword.feature +36 -0
- data/features/step_definitions/cucumber_steps.rb +153 -7
- data/features/step_definitions/extra_steps.rb +2 -0
- data/features/step_definitions/simplest_steps.rb +3 -0
- data/features/step_definitions/wire_steps.rb +32 -0
- data/features/support/env.rb +140 -18
- data/features/support/env.rb.simplest +7 -0
- data/features/support/fake_wire_server.rb +77 -0
- data/features/table_diffing.feature +45 -0
- data/features/table_mapping.feature +34 -0
- data/features/tag_logic.feature +258 -0
- data/features/transform.feature +245 -0
- data/features/unicode_table.feature +35 -0
- data/features/usage_and_stepdefs_formatter.feature +169 -0
- data/features/wire_protocol.feature +332 -0
- data/features/wire_protocol_table_diffing.feature +119 -0
- data/features/wire_protocol_tags.feature +87 -0
- data/features/wire_protocol_timeouts.feature +63 -0
- data/features/work_in_progress.feature +156 -0
- data/fixtures/json/features/pystring.feature +8 -0
- data/fixtures/junit/features/pending.feature +1 -3
- data/fixtures/self_test/features/background/background_tagged_before_on_outline.feature +12 -0
- data/fixtures/self_test/features/background/background_with_name.feature +7 -0
- data/fixtures/self_test/features/background/failing_background.feature +12 -0
- data/fixtures/self_test/features/background/failing_background_after_success.feature +11 -0
- data/fixtures/self_test/features/background/multiline_args_background.feature +32 -0
- data/fixtures/self_test/features/background/passing_background.feature +10 -0
- data/fixtures/self_test/features/background/pending_background.feature +10 -0
- data/fixtures/self_test/features/background/scenario_outline_failing_background.feature +16 -0
- data/fixtures/self_test/features/background/scenario_outline_passing_background.feature +16 -0
- data/fixtures/self_test/features/support/env.rb +0 -8
- data/fixtures/tickets/features.html +1 -1
- data/gem_tasks/examples.rake +1 -1
- data/gem_tasks/features.rake +14 -0
- data/gem_tasks/sdoc.rake +12 -0
- data/lib/cucumber.rb +0 -12
- data/lib/cucumber/ast.rb +1 -1
- data/lib/cucumber/ast/background.rb +5 -21
- data/lib/cucumber/ast/examples.rb +4 -12
- data/lib/cucumber/ast/feature.rb +5 -13
- data/lib/cucumber/ast/feature_element.rb +4 -9
- data/lib/cucumber/ast/outline_table.rb +4 -4
- data/lib/cucumber/ast/py_string.rb +80 -0
- data/lib/cucumber/ast/scenario.rb +5 -7
- data/lib/cucumber/ast/scenario_outline.rb +15 -23
- data/lib/cucumber/ast/step.rb +0 -5
- data/lib/cucumber/ast/step_invocation.rb +15 -21
- data/lib/cucumber/ast/table.rb +8 -14
- data/lib/cucumber/ast/tree_walker.rb +48 -10
- data/lib/cucumber/cli/configuration.rb +8 -33
- data/lib/cucumber/cli/main.rb +35 -20
- data/lib/cucumber/cli/options.rb +7 -8
- data/lib/cucumber/cli/profile_loader.rb +0 -2
- data/lib/cucumber/core_ext/proc.rb +1 -2
- data/lib/cucumber/feature_file.rb +15 -47
- data/lib/cucumber/formatter/ansicolor.rb +5 -3
- data/lib/cucumber/formatter/color_io.rb +23 -0
- data/lib/cucumber/formatter/console.rb +23 -27
- data/lib/cucumber/formatter/cucumber.css +17 -34
- data/lib/cucumber/formatter/cucumber.sass +182 -173
- data/lib/cucumber/formatter/html.rb +11 -46
- data/lib/cucumber/formatter/io.rb +4 -2
- data/lib/cucumber/formatter/json.rb +152 -15
- data/lib/cucumber/formatter/json_pretty.rb +6 -5
- data/lib/cucumber/formatter/junit.rb +22 -28
- data/lib/cucumber/formatter/pdf.rb +6 -6
- data/lib/cucumber/formatter/pretty.rb +5 -5
- data/lib/cucumber/formatter/rerun.rb +11 -22
- data/lib/cucumber/formatter/tag_cloud.rb +35 -0
- data/lib/cucumber/formatter/unicode.rb +20 -41
- data/lib/cucumber/js_support/js_dsl.js +4 -4
- data/lib/cucumber/js_support/js_language.rb +5 -9
- data/lib/cucumber/js_support/js_snippets.rb +2 -2
- data/lib/cucumber/language_support.rb +2 -2
- data/lib/cucumber/parser/gherkin_builder.rb +30 -35
- data/lib/cucumber/platform.rb +8 -8
- data/lib/cucumber/py_support/py_language.rb +2 -2
- data/lib/cucumber/rake/task.rb +31 -74
- data/lib/cucumber/rb_support/rb_dsl.rb +0 -1
- data/lib/cucumber/rb_support/rb_language.rb +8 -10
- data/lib/cucumber/rb_support/rb_step_definition.rb +0 -8
- data/lib/cucumber/rb_support/rb_transform.rb +0 -17
- data/lib/cucumber/rb_support/rb_world.rb +18 -26
- data/lib/cucumber/rspec/doubles.rb +3 -3
- data/lib/cucumber/step_match.rb +2 -6
- data/lib/cucumber/step_mother.rb +427 -6
- data/lib/cucumber/wire_support/configuration.rb +1 -4
- data/lib/cucumber/wire_support/wire_language.rb +10 -3
- data/spec/cucumber/ast/background_spec.rb +6 -68
- data/spec/cucumber/ast/feature_factory.rb +4 -5
- data/spec/cucumber/ast/feature_spec.rb +4 -4
- data/spec/cucumber/ast/outline_table_spec.rb +1 -1
- data/spec/cucumber/ast/py_string_spec.rb +40 -0
- data/spec/cucumber/ast/scenario_outline_spec.rb +11 -15
- data/spec/cucumber/ast/scenario_spec.rb +4 -4
- data/spec/cucumber/ast/step_spec.rb +3 -3
- data/spec/cucumber/ast/table_spec.rb +2 -38
- data/spec/cucumber/ast/tree_walker_spec.rb +2 -2
- data/spec/cucumber/broadcaster_spec.rb +1 -1
- data/spec/cucumber/cli/configuration_spec.rb +6 -32
- data/spec/cucumber/cli/drb_client_spec.rb +3 -2
- data/spec/cucumber/cli/main_spec.rb +43 -43
- data/spec/cucumber/cli/options_spec.rb +1 -28
- data/spec/cucumber/cli/profile_loader_spec.rb +1 -1
- data/spec/cucumber/core_ext/proc_spec.rb +1 -1
- data/spec/cucumber/formatter/ansicolor_spec.rb +1 -1
- data/spec/cucumber/formatter/color_io_spec.rb +29 -0
- data/spec/cucumber/formatter/duration_spec.rb +1 -1
- data/spec/cucumber/formatter/html_spec.rb +5 -3
- data/spec/cucumber/formatter/junit_spec.rb +2 -16
- data/spec/cucumber/formatter/progress_spec.rb +1 -1
- data/spec/cucumber/formatter/spec_helper.rb +12 -11
- data/spec/cucumber/rb_support/rb_language_spec.rb +28 -241
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +28 -33
- data/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb +1 -1
- data/spec/cucumber/step_match_spec.rb +9 -11
- data/spec/cucumber/step_mother_spec.rb +302 -0
- data/spec/cucumber/wire_support/configuration_spec.rb +1 -1
- data/spec/cucumber/wire_support/connection_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_exception_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_language_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_packet_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_step_definition_spec.rb +1 -1
- data/spec/cucumber/world/pending_spec.rb +2 -2
- data/spec/spec_helper.rb +20 -13
- metadata +78 -4
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
2
|
+
|
|
3
|
+
require 'cucumber'
|
|
4
|
+
require 'cucumber/rb_support/rb_language'
|
|
5
|
+
|
|
6
|
+
module Cucumber
|
|
7
|
+
describe StepMother do
|
|
8
|
+
before do
|
|
9
|
+
@dsl = Object.new
|
|
10
|
+
@dsl.extend(RbSupport::RbDsl)
|
|
11
|
+
|
|
12
|
+
@step_mother = StepMother.new
|
|
13
|
+
|
|
14
|
+
@rb = @step_mother.load_programming_language('rb')
|
|
15
|
+
|
|
16
|
+
@visitor = mock('Visitor')
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "should format step names" do
|
|
20
|
+
@dsl.Given(/it (.*) in (.*)/) do |what, month|
|
|
21
|
+
end
|
|
22
|
+
@dsl.Given(/nope something else/) do |what, month|
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
format = @step_mother.step_match("it snows in april").format_args("[%s]")
|
|
26
|
+
format.should == "it [snows] in [april]"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "should raise Ambiguous error with guess hint when multiple step definitions match" do
|
|
30
|
+
@dsl.Given(/Three (.*) mice/) {|disability|}
|
|
31
|
+
@dsl.Given(/Three blind (.*)/) {|animal|}
|
|
32
|
+
|
|
33
|
+
lambda do
|
|
34
|
+
@step_mother.step_match("Three blind mice")
|
|
35
|
+
end.should raise_error(Ambiguous, %{Ambiguous match of "Three blind mice":
|
|
36
|
+
|
|
37
|
+
spec/cucumber/step_mother_spec.rb:30:in `/Three (.*) mice/'
|
|
38
|
+
spec/cucumber/step_mother_spec.rb:31:in `/Three blind (.*)/'
|
|
39
|
+
|
|
40
|
+
You can run again with --guess to make Cucumber be more smart about it
|
|
41
|
+
})
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it "should not show --guess hint when --guess is used" do
|
|
45
|
+
@step_mother.options = {:guess => true}
|
|
46
|
+
|
|
47
|
+
@dsl.Given(/Three (.*) mice/) {|disability|}
|
|
48
|
+
@dsl.Given(/Three cute (.*)/) {|animal|}
|
|
49
|
+
|
|
50
|
+
lambda do
|
|
51
|
+
@step_mother.step_match("Three cute mice")
|
|
52
|
+
end.should raise_error(Ambiguous, %{Ambiguous match of "Three cute mice":
|
|
53
|
+
|
|
54
|
+
spec/cucumber/step_mother_spec.rb:47:in `/Three (.*) mice/'
|
|
55
|
+
spec/cucumber/step_mother_spec.rb:48:in `/Three cute (.*)/'
|
|
56
|
+
|
|
57
|
+
})
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it "should not raise Ambiguous error when multiple step definitions match, but --guess is enabled" do
|
|
61
|
+
@step_mother.options = {:guess => true}
|
|
62
|
+
@dsl.Given(/Three (.*) mice/) {|disability|}
|
|
63
|
+
@dsl.Given(/Three (.*)/) {|animal|}
|
|
64
|
+
|
|
65
|
+
lambda do
|
|
66
|
+
@step_mother.step_match("Three blind mice")
|
|
67
|
+
end.should_not raise_error
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it "should not raise NoMethodError when guessing from multiple step definitions with nil fields" do
|
|
71
|
+
@step_mother.options = {:guess => true}
|
|
72
|
+
@dsl.Given(/Three (.*) mice( cannot find food)?/) {|disability, is_disastrous|}
|
|
73
|
+
@dsl.Given(/Three (.*)?/) {|animal|}
|
|
74
|
+
|
|
75
|
+
lambda do
|
|
76
|
+
@step_mother.step_match("Three blind mice")
|
|
77
|
+
end.should_not raise_error
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
it "should pick right step definition when --guess is enabled and equal number of capture groups" do
|
|
81
|
+
@step_mother.options = {:guess => true}
|
|
82
|
+
right = @dsl.Given(/Three (.*) mice/) {|disability|}
|
|
83
|
+
wrong = @dsl.Given(/Three (.*)/) {|animal|}
|
|
84
|
+
|
|
85
|
+
@step_mother.step_match("Three blind mice").step_definition.should == right
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
it "should pick right step definition when --guess is enabled and unequal number of capture groups" do
|
|
89
|
+
@step_mother.options = {:guess => true}
|
|
90
|
+
right = @dsl.Given(/Three (.*) mice ran (.*)/) {|disability|}
|
|
91
|
+
wrong = @dsl.Given(/Three (.*)/) {|animal|}
|
|
92
|
+
|
|
93
|
+
@step_mother.step_match("Three blind mice ran far").step_definition.should == right
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
it "should pick most specific step definition when --guess is enabled and unequal number of capture groups" do
|
|
97
|
+
@step_mother.options = {:guess => true}
|
|
98
|
+
general = @dsl.Given(/Three (.*) mice ran (.*)/) {|disability|}
|
|
99
|
+
specific = @dsl.Given(/Three blind mice ran far/) do; end
|
|
100
|
+
more_specific = @dsl.Given(/^Three blind mice ran far$/) do; end
|
|
101
|
+
|
|
102
|
+
@step_mother.step_match("Three blind mice ran far").step_definition.should == more_specific
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
it "should raise Undefined error when no step definitions match" do
|
|
106
|
+
lambda do
|
|
107
|
+
@step_mother.step_match("Three blind mice")
|
|
108
|
+
end.should raise_error(Undefined)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# http://railsforum.com/viewtopic.php?pid=93881
|
|
112
|
+
it "should not raise Redundant unless it's really redundant" do
|
|
113
|
+
@dsl.Given(/^(.*) (.*) user named '(.*)'$/) {|a,b,c|}
|
|
114
|
+
@dsl.Given(/^there is no (.*) user named '(.*)'$/) {|a,b|}
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
it "should raise an error if the world is nil" do
|
|
118
|
+
@dsl.World {}
|
|
119
|
+
|
|
120
|
+
begin
|
|
121
|
+
@step_mother.before_and_after(nil) do; end
|
|
122
|
+
raise "Should fail"
|
|
123
|
+
rescue RbSupport::NilWorld => e
|
|
124
|
+
e.message.should == "World procs should never return nil"
|
|
125
|
+
e.backtrace.should == ["spec/cucumber/step_mother_spec.rb:118:in `World'"]
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
module ModuleOne
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
module ModuleTwo
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
class ClassOne
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
it "should implicitly extend world with modules" do
|
|
139
|
+
@dsl.World(ModuleOne, ModuleTwo)
|
|
140
|
+
@step_mother.before(mock('scenario').as_null_object)
|
|
141
|
+
class << @rb.current_world
|
|
142
|
+
included_modules.inspect.should =~ /ModuleOne/ # Workaround for RSpec/Ruby 1.9 issue with namespaces
|
|
143
|
+
included_modules.inspect.should =~ /ModuleTwo/
|
|
144
|
+
end
|
|
145
|
+
@rb.current_world.class.should == Object
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
it "should raise error when we try to register more than one World proc" do
|
|
149
|
+
@dsl.World { Hash.new }
|
|
150
|
+
lambda do
|
|
151
|
+
@dsl.World { Array.new }
|
|
152
|
+
end.should raise_error(RbSupport::MultipleWorld, %{You can only pass a proc to #World once, but it's happening
|
|
153
|
+
in 2 places:
|
|
154
|
+
|
|
155
|
+
spec/cucumber/step_mother_spec.rb:149:in `World'
|
|
156
|
+
spec/cucumber/step_mother_spec.rb:151:in `World'
|
|
157
|
+
|
|
158
|
+
Use Ruby modules instead to extend your worlds. See the Cucumber::RbSupport::RbDsl#World RDoc
|
|
159
|
+
or http://wiki.github.com/aslakhellesoy/cucumber/a-whole-new-world.
|
|
160
|
+
|
|
161
|
+
})
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
it "should find before hooks" do
|
|
165
|
+
fish = @dsl.Before('@fish'){}
|
|
166
|
+
meat = @dsl.Before('@meat'){}
|
|
167
|
+
|
|
168
|
+
scenario = mock('Scenario')
|
|
169
|
+
scenario.should_receive(:accept_hook?).with(fish).and_return(true)
|
|
170
|
+
scenario.should_receive(:accept_hook?).with(meat).and_return(false)
|
|
171
|
+
|
|
172
|
+
@rb.hooks_for(:before, scenario).should == [fish]
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
it "should find around hooks" do
|
|
176
|
+
a = @dsl.Around do |scenario, block|
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
b = @dsl.Around('@tag') do |scenario, block|
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
scenario = mock('Scenario')
|
|
183
|
+
scenario.should_receive(:accept_hook?).with(a).and_return(true)
|
|
184
|
+
scenario.should_receive(:accept_hook?).with(b).and_return(false)
|
|
185
|
+
|
|
186
|
+
@rb.hooks_for(:around, scenario).should == [a]
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
describe StepMother, "step argument transformations" do
|
|
191
|
+
before do
|
|
192
|
+
@dsl = Object.new
|
|
193
|
+
@dsl.extend(RbSupport::RbDsl)
|
|
194
|
+
|
|
195
|
+
@step_mother = StepMother.new
|
|
196
|
+
|
|
197
|
+
@rb = @step_mother.load_programming_language('rb')
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
describe "without capture groups" do
|
|
201
|
+
it "complains when registering with a with no transform block" do
|
|
202
|
+
lambda do
|
|
203
|
+
@dsl.Transform('^abc$')
|
|
204
|
+
end.should raise_error(Cucumber::RbSupport::RbTransform::MissingProc)
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
it "complains when registering with a zero-arg transform block" do
|
|
208
|
+
lambda do
|
|
209
|
+
@dsl.Transform('^abc$') {42}
|
|
210
|
+
end.should raise_error(Cucumber::RbSupport::RbTransform::MissingProc)
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
it "complains when registering with a splat-arg transform block" do
|
|
214
|
+
lambda do
|
|
215
|
+
@dsl.Transform('^abc$') {|*splat| 42 }
|
|
216
|
+
end.should raise_error(Cucumber::RbSupport::RbTransform::MissingProc)
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
it "complains when transforming with an arity mismatch" do
|
|
220
|
+
lambda do
|
|
221
|
+
@dsl.Transform('^abc$') {|one, two| 42 }
|
|
222
|
+
@rb.execute_transforms(['abc'])
|
|
223
|
+
end.should raise_error(Cucumber::ArityMismatchError)
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
it "allows registering a regexp pattern that yields the step_arg matched" do
|
|
227
|
+
@dsl.Transform(/^ab*c$/) {|arg| 42}
|
|
228
|
+
@rb.execute_transforms(['ab']).should == ['ab']
|
|
229
|
+
@rb.execute_transforms(['ac']).should == [42]
|
|
230
|
+
@rb.execute_transforms(['abc']).should == [42]
|
|
231
|
+
@rb.execute_transforms(['abbc']).should == [42]
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
describe "with capture groups" do
|
|
236
|
+
it "complains when registering with a with no transform block" do
|
|
237
|
+
lambda do
|
|
238
|
+
@dsl.Transform('^a(.)c$')
|
|
239
|
+
end.should raise_error(Cucumber::RbSupport::RbTransform::MissingProc)
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
it "complains when registering with a zero-arg transform block" do
|
|
243
|
+
lambda do
|
|
244
|
+
@dsl.Transform('^a(.)c$') { 42 }
|
|
245
|
+
end.should raise_error(Cucumber::RbSupport::RbTransform::MissingProc)
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
it "complains when registering with a splat-arg transform block" do
|
|
249
|
+
lambda do
|
|
250
|
+
@dsl.Transform('^a(.)c$') {|*splat| 42 }
|
|
251
|
+
end.should raise_error(Cucumber::RbSupport::RbTransform::MissingProc)
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
it "complains when transforming with an arity mismatch" do
|
|
255
|
+
lambda do
|
|
256
|
+
@dsl.Transform('^a(.)c$') {|one, two| 42 }
|
|
257
|
+
@rb.execute_transforms(['abc'])
|
|
258
|
+
end.should raise_error(Cucumber::ArityMismatchError)
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
it "allows registering a regexp pattern that yields capture groups" do
|
|
262
|
+
@dsl.Transform(/^shape: (.+), color: (.+)$/) do |shape, color|
|
|
263
|
+
{shape.to_sym => color.to_sym}
|
|
264
|
+
end
|
|
265
|
+
@rb.execute_transforms(['shape: circle, color: blue']).should == [{:circle => :blue}]
|
|
266
|
+
@rb.execute_transforms(['shape: square, color: red']).should == [{:square => :red}]
|
|
267
|
+
@rb.execute_transforms(['not shape: square, not color: red']).should == ['not shape: square, not color: red']
|
|
268
|
+
end
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
it "allows registering a string pattern" do
|
|
272
|
+
@dsl.Transform('^ab*c$') {|arg| 42}
|
|
273
|
+
@rb.execute_transforms(['ab']).should == ['ab']
|
|
274
|
+
@rb.execute_transforms(['ac']).should == [42]
|
|
275
|
+
@rb.execute_transforms(['abc']).should == [42]
|
|
276
|
+
@rb.execute_transforms(['abbc']).should == [42]
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
it "gives match priority to transforms defined last" do
|
|
280
|
+
@dsl.Transform(/^transform_me$/) {|arg| :foo }
|
|
281
|
+
@dsl.Transform(/^transform_me$/) {|arg| :bar }
|
|
282
|
+
@dsl.Transform(/^transform_me$/) {|arg| :baz }
|
|
283
|
+
@rb.execute_transforms(['transform_me']).should == [:baz]
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
it "allows registering a transform which returns nil" do
|
|
287
|
+
@dsl.Transform('^ac$') {|arg| nil}
|
|
288
|
+
@rb.execute_transforms(['ab']).should == ['ab']
|
|
289
|
+
@rb.execute_transforms(['ac']).should == [nil]
|
|
290
|
+
end
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
module ModuleOne
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
module ModuleTwo
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
class ClassOne
|
|
302
|
+
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
2
2
|
require 'cucumber/rb_support/rb_language'
|
|
3
3
|
|
|
4
4
|
module Cucumber
|
|
5
5
|
describe 'Pending' do
|
|
6
6
|
|
|
7
7
|
before(:each) do
|
|
8
|
-
l = RbSupport::RbLanguage.new(
|
|
8
|
+
l = RbSupport::RbLanguage.new(StepMother.new)
|
|
9
9
|
l.begin_rb_scenario(mock('scenario').as_null_object)
|
|
10
10
|
@world = l.current_world
|
|
11
11
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -2,21 +2,28 @@ ENV['CUCUMBER_COLORS']=nil
|
|
|
2
2
|
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
|
3
3
|
$:.unshift(File.dirname(__FILE__))
|
|
4
4
|
|
|
5
|
-
# For Travis....
|
|
6
|
-
if defined? Encoding
|
|
7
|
-
Encoding.default_external = 'utf-8'
|
|
8
|
-
Encoding.default_internal = 'utf-8'
|
|
9
|
-
end
|
|
10
|
-
|
|
11
5
|
require 'rubygems'
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
|
|
7
|
+
begin
|
|
8
|
+
require 'rspec'
|
|
9
|
+
require 'rspec/autorun'
|
|
10
|
+
RSpec.configure do |c|
|
|
11
|
+
c.color_enabled = true
|
|
12
|
+
c.before(:each) do
|
|
13
|
+
::Term::ANSIColor.coloring = true
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
rescue LoadError
|
|
17
|
+
require 'spec'
|
|
18
|
+
require 'spec/autorun'
|
|
19
|
+
Spec::Runner.configure do |c|
|
|
20
|
+
c.before(:each) do
|
|
21
|
+
::Term::ANSIColor.coloring = true
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
14
25
|
|
|
15
26
|
require 'cucumber'
|
|
16
27
|
$KCODE='u' unless Cucumber::RUBY_1_9
|
|
17
28
|
|
|
18
|
-
|
|
19
|
-
c.before do
|
|
20
|
-
::Term::ANSIColor.coloring = true
|
|
21
|
-
end
|
|
22
|
-
end
|
|
29
|
+
alias running lambda
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cucumber
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 49
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 8
|
|
9
|
-
-
|
|
10
|
-
version: 0.8.
|
|
9
|
+
- 7
|
|
10
|
+
version: 0.8.7
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- "Aslak Helles\xC3\xB8y"
|
|
@@ -204,11 +204,16 @@ extensions: []
|
|
|
204
204
|
|
|
205
205
|
extra_rdoc_files:
|
|
206
206
|
- LICENSE
|
|
207
|
+
- README.rdoc
|
|
207
208
|
files:
|
|
208
209
|
- .gitattributes
|
|
209
210
|
- .rspec
|
|
211
|
+
- Caliper.yml
|
|
212
|
+
- History.txt
|
|
210
213
|
- LICENSE
|
|
214
|
+
- README.rdoc
|
|
211
215
|
- Rakefile
|
|
216
|
+
- VERSION.yml
|
|
212
217
|
- bin/cucumber
|
|
213
218
|
- cucumber.gemspec
|
|
214
219
|
- cucumber.yml
|
|
@@ -343,6 +348,7 @@ files:
|
|
|
343
348
|
- examples/i18n/pt/lib/calculadora.rb
|
|
344
349
|
- examples/i18n/ro/Rakefile
|
|
345
350
|
- examples/i18n/ro/features/step_definitons/calculator_steps.rb
|
|
351
|
+
- examples/i18n/ro/features/suma.feature
|
|
346
352
|
- examples/i18n/ro/lib/calculator.rb
|
|
347
353
|
- examples/i18n/ru/Rakefile
|
|
348
354
|
- examples/i18n/ru/features/addition.feature
|
|
@@ -458,14 +464,65 @@ files:
|
|
|
458
464
|
- examples/watir/features/step_definitions/search_steps.rb
|
|
459
465
|
- examples/watir/features/support/env.rb
|
|
460
466
|
- examples/watir/features/support/screenshots.rb
|
|
467
|
+
- features/announce.feature
|
|
468
|
+
- features/around_hooks.feature
|
|
461
469
|
- features/background.feature
|
|
470
|
+
- features/bug_371.feature
|
|
471
|
+
- features/bug_464.feature
|
|
472
|
+
- features/bug_475.feature
|
|
473
|
+
- features/bug_585_tab_indentation.feature
|
|
474
|
+
- features/bug_600.feature
|
|
475
|
+
- features/call_steps_from_stepdefs.feature
|
|
476
|
+
- features/cucumber_cli.feature
|
|
477
|
+
- features/cucumber_cli_outlines.feature
|
|
462
478
|
- features/custom_formatter.feature
|
|
479
|
+
- features/default_snippets.feature
|
|
480
|
+
- features/diffing.feature
|
|
481
|
+
- features/drb_server_integration.feature
|
|
482
|
+
- features/exception_in_after_block.feature
|
|
483
|
+
- features/exception_in_after_step_block.feature
|
|
484
|
+
- features/exception_in_before_block.feature
|
|
485
|
+
- features/exclude_files.feature
|
|
486
|
+
- features/expand.feature
|
|
487
|
+
- features/html_formatter.feature
|
|
488
|
+
- features/html_formatter/a.html
|
|
463
489
|
- features/json_formatter.feature
|
|
490
|
+
- features/junit_formatter.feature
|
|
491
|
+
- features/language_from_header.feature
|
|
492
|
+
- features/language_help.feature
|
|
493
|
+
- features/listener_debugger_formatter.feature
|
|
494
|
+
- features/multiline_names.feature
|
|
495
|
+
- features/negative_tagged_hooks.feature
|
|
496
|
+
- features/post_configuration_hook.feature
|
|
497
|
+
- features/profiles.feature
|
|
498
|
+
- features/rake_task.feature
|
|
499
|
+
- features/report_called_undefined_steps.feature
|
|
500
|
+
- features/rerun_formatter.feature
|
|
501
|
+
- features/simplest.feature
|
|
502
|
+
- features/snippet.feature
|
|
503
|
+
- features/snippets_when_using_star_keyword.feature
|
|
464
504
|
- features/step_definitions/cucumber_steps.rb
|
|
505
|
+
- features/step_definitions/extra_steps.rb
|
|
506
|
+
- features/step_definitions/simplest_steps.rb
|
|
507
|
+
- features/step_definitions/wire_steps.rb
|
|
465
508
|
- features/support/env.rb
|
|
509
|
+
- features/support/env.rb.simplest
|
|
510
|
+
- features/support/fake_wire_server.rb
|
|
511
|
+
- features/table_diffing.feature
|
|
512
|
+
- features/table_mapping.feature
|
|
513
|
+
- features/tag_logic.feature
|
|
514
|
+
- features/transform.feature
|
|
515
|
+
- features/unicode_table.feature
|
|
516
|
+
- features/usage_and_stepdefs_formatter.feature
|
|
517
|
+
- features/wire_protocol.feature
|
|
518
|
+
- features/wire_protocol_table_diffing.feature
|
|
519
|
+
- features/wire_protocol_tags.feature
|
|
520
|
+
- features/wire_protocol_timeouts.feature
|
|
521
|
+
- features/work_in_progress.feature
|
|
466
522
|
- fixtures/json/features/background.feature
|
|
467
523
|
- fixtures/json/features/embed.feature
|
|
468
524
|
- fixtures/json/features/one_passing_one_failing.feature
|
|
525
|
+
- fixtures/json/features/pystring.feature
|
|
469
526
|
- fixtures/json/features/step_definitions/steps.rb
|
|
470
527
|
- fixtures/json/features/tables.feature
|
|
471
528
|
- fixtures/junit/features/one_passing_one_failing.feature
|
|
@@ -474,6 +531,15 @@ files:
|
|
|
474
531
|
- fixtures/self_test/.gitignore
|
|
475
532
|
- fixtures/self_test/README.textile
|
|
476
533
|
- fixtures/self_test/Rakefile
|
|
534
|
+
- fixtures/self_test/features/background/background_tagged_before_on_outline.feature
|
|
535
|
+
- fixtures/self_test/features/background/background_with_name.feature
|
|
536
|
+
- fixtures/self_test/features/background/failing_background.feature
|
|
537
|
+
- fixtures/self_test/features/background/failing_background_after_success.feature
|
|
538
|
+
- fixtures/self_test/features/background/multiline_args_background.feature
|
|
539
|
+
- fixtures/self_test/features/background/passing_background.feature
|
|
540
|
+
- fixtures/self_test/features/background/pending_background.feature
|
|
541
|
+
- fixtures/self_test/features/background/scenario_outline_failing_background.feature
|
|
542
|
+
- fixtures/self_test/features/background/scenario_outline_passing_background.feature
|
|
477
543
|
- fixtures/self_test/features/call_undefined_step_from_step_def.feature
|
|
478
544
|
- fixtures/self_test/features/failing_expectation.feature
|
|
479
545
|
- fixtures/self_test/features/lots_of_undefined.feature
|
|
@@ -530,10 +596,12 @@ files:
|
|
|
530
596
|
- gem_tasks/contributors.rake
|
|
531
597
|
- gem_tasks/environment.rake
|
|
532
598
|
- gem_tasks/examples.rake
|
|
599
|
+
- gem_tasks/features.rake
|
|
533
600
|
- gem_tasks/fix_cr_lf.rake
|
|
534
601
|
- gem_tasks/flog.rake
|
|
535
602
|
- gem_tasks/rspec.rake
|
|
536
603
|
- gem_tasks/sass.rake
|
|
604
|
+
- gem_tasks/sdoc.rake
|
|
537
605
|
- lib/README.rdoc
|
|
538
606
|
- lib/autotest/cucumber.rb
|
|
539
607
|
- lib/autotest/cucumber_mixin.rb
|
|
@@ -552,6 +620,7 @@ files:
|
|
|
552
620
|
- lib/cucumber/ast/feature_element.rb
|
|
553
621
|
- lib/cucumber/ast/features.rb
|
|
554
622
|
- lib/cucumber/ast/outline_table.rb
|
|
623
|
+
- lib/cucumber/ast/py_string.rb
|
|
555
624
|
- lib/cucumber/ast/scenario.rb
|
|
556
625
|
- lib/cucumber/ast/scenario_outline.rb
|
|
557
626
|
- lib/cucumber/ast/step.rb
|
|
@@ -573,6 +642,7 @@ files:
|
|
|
573
642
|
- lib/cucumber/core_ext/string.rb
|
|
574
643
|
- lib/cucumber/feature_file.rb
|
|
575
644
|
- lib/cucumber/formatter/ansicolor.rb
|
|
645
|
+
- lib/cucumber/formatter/color_io.rb
|
|
576
646
|
- lib/cucumber/formatter/console.rb
|
|
577
647
|
- lib/cucumber/formatter/cucumber.css
|
|
578
648
|
- lib/cucumber/formatter/cucumber.sass
|
|
@@ -592,6 +662,7 @@ files:
|
|
|
592
662
|
- lib/cucumber/formatter/stepdefs.rb
|
|
593
663
|
- lib/cucumber/formatter/steps.rb
|
|
594
664
|
- lib/cucumber/formatter/summary.rb
|
|
665
|
+
- lib/cucumber/formatter/tag_cloud.rb
|
|
595
666
|
- lib/cucumber/formatter/unicode.rb
|
|
596
667
|
- lib/cucumber/formatter/usage.rb
|
|
597
668
|
- lib/cucumber/js_support/js_dsl.js
|
|
@@ -632,6 +703,7 @@ files:
|
|
|
632
703
|
- spec/cucumber/ast/feature_factory.rb
|
|
633
704
|
- spec/cucumber/ast/feature_spec.rb
|
|
634
705
|
- spec/cucumber/ast/outline_table_spec.rb
|
|
706
|
+
- spec/cucumber/ast/py_string_spec.rb
|
|
635
707
|
- spec/cucumber/ast/scenario_outline_spec.rb
|
|
636
708
|
- spec/cucumber/ast/scenario_spec.rb
|
|
637
709
|
- spec/cucumber/ast/step_spec.rb
|
|
@@ -645,6 +717,7 @@ files:
|
|
|
645
717
|
- spec/cucumber/cli/profile_loader_spec.rb
|
|
646
718
|
- spec/cucumber/core_ext/proc_spec.rb
|
|
647
719
|
- spec/cucumber/formatter/ansicolor_spec.rb
|
|
720
|
+
- spec/cucumber/formatter/color_io_spec.rb
|
|
648
721
|
- spec/cucumber/formatter/duration_spec.rb
|
|
649
722
|
- spec/cucumber/formatter/html_spec.rb
|
|
650
723
|
- spec/cucumber/formatter/junit_spec.rb
|
|
@@ -655,6 +728,7 @@ files:
|
|
|
655
728
|
- spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
|
|
656
729
|
- spec/cucumber/sell_cucumbers.feature
|
|
657
730
|
- spec/cucumber/step_match_spec.rb
|
|
731
|
+
- spec/cucumber/step_mother_spec.rb
|
|
658
732
|
- spec/cucumber/wire_support/configuration_spec.rb
|
|
659
733
|
- spec/cucumber/wire_support/connection_spec.rb
|
|
660
734
|
- spec/cucumber/wire_support/wire_exception_spec.rb
|
|
@@ -673,7 +747,7 @@ post_install_message: |+
|
|
|
673
747
|
|
|
674
748
|
(::) U P G R A D I N G (::)
|
|
675
749
|
|
|
676
|
-
Thank you for installing cucumber-0.8.
|
|
750
|
+
Thank you for installing cucumber-0.8.7.
|
|
677
751
|
Please be sure to read http://wiki.github.com/aslakhellesoy/cucumber/upgrading
|
|
678
752
|
for important information about this release. Happy cuking!
|
|
679
753
|
|