cucumber 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +10 -0
- data/Gemfile +3 -1
- data/History.md +18 -2
- data/README.md +5 -1
- data/cucumber.gemspec +3 -4
- data/cucumber.yml +2 -2
- data/features/docs/api/run_cli_main_with_existing_runtime.feature +4 -7
- data/features/docs/defining_steps/skip_scenario.feature +6 -2
- data/features/docs/formatters/api_methods.feature +36 -0
- data/features/docs/profiles.feature +2 -2
- data/features/lib/step_definitions/profile_steps.rb +1 -1
- data/lib/cucumber.rb +11 -4
- data/lib/cucumber/cli/configuration.rb +2 -2
- data/lib/cucumber/cli/options.rb +2 -2
- data/lib/cucumber/configuration.rb +25 -3
- data/lib/cucumber/deprecate.rb +29 -0
- data/lib/cucumber/filters/activate_steps.rb +39 -5
- data/lib/cucumber/formatter/console.rb +4 -4
- data/lib/cucumber/formatter/io.rb +1 -1
- data/lib/cucumber/formatter/legacy_api/adapter.rb +30 -30
- data/lib/cucumber/formatter/legacy_api/runtime_facade.rb +4 -9
- data/lib/cucumber/platform.rb +2 -7
- data/lib/cucumber/rb_support/rb_language.rb +72 -26
- data/lib/cucumber/rb_support/rb_step_definition.rb +2 -2
- data/lib/cucumber/rb_support/rb_world.rb +6 -1
- data/lib/cucumber/rb_support/snippet.rb +21 -0
- data/lib/cucumber/running_test_case.rb +5 -1
- data/lib/cucumber/runtime.rb +11 -15
- data/lib/cucumber/runtime/support_code.rb +20 -128
- data/lib/cucumber/step_argument.rb +25 -0
- data/lib/cucumber/step_match.rb +6 -12
- data/lib/cucumber/step_match_search.rb +67 -0
- data/lib/cucumber/version +1 -0
- data/spec/cucumber/configuration_spec.rb +3 -2
- data/spec/cucumber/filters/activate_steps_spec.rb +95 -3
- data/spec/cucumber/formatter/html_spec.rb +1 -1
- data/spec/cucumber/formatter/legacy_api/adapter_spec.rb +55 -28
- data/spec/cucumber/formatter/pretty_spec.rb +2 -2
- data/spec/cucumber/formatter/spec_helper.rb +22 -12
- data/spec/cucumber/rb_support/rb_language_spec.rb +9 -45
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +2 -2
- data/spec/cucumber/rb_support/rb_world_spec.rb +47 -0
- data/spec/cucumber/runtime/for_programming_languages_spec.rb +1 -1
- data/spec/cucumber/runtime/support_code_spec.rb +4 -111
- data/spec/cucumber/step_argument_spec.rb +18 -0
- data/spec/cucumber/step_match_search_spec.rb +122 -0
- data/spec/cucumber/step_match_spec.rb +8 -2
- data/spec/cucumber/world/pending_spec.rb +2 -1
- data/spec/cucumber_spec.rb +39 -0
- metadata +45 -50
- data/features/docs/wire_protocol/erb_configuration.feature +0 -56
- data/features/docs/wire_protocol/handle_unexpected_response.feature +0 -30
- data/features/docs/wire_protocol/invoke_message.feature +0 -216
- data/features/docs/wire_protocol/readme.md +0 -26
- data/features/docs/wire_protocol/snippets_message.feature +0 -51
- data/features/docs/wire_protocol/step_matches_message.feature +0 -81
- data/features/docs/wire_protocol/table_diffing.feature +0 -126
- data/features/docs/wire_protocol/tags.feature +0 -87
- data/features/docs/wire_protocol/timeouts.feature +0 -64
- data/lib/cucumber/events/bus.rb +0 -86
- data/lib/cucumber/gherkin/formatter/argument.rb +0 -17
- data/lib/cucumber/gherkin/formatter/hashable.rb +0 -27
- data/lib/cucumber/language_support.rb +0 -30
- data/lib/cucumber/language_support/language_methods.rb +0 -72
- data/lib/cucumber/rb_support/regexp_argument_matcher.rb +0 -21
- data/lib/cucumber/wire_support/configuration.rb +0 -38
- data/lib/cucumber/wire_support/connection.rb +0 -61
- data/lib/cucumber/wire_support/request_handler.rb +0 -32
- data/lib/cucumber/wire_support/wire_exception.rb +0 -32
- data/lib/cucumber/wire_support/wire_language.rb +0 -68
- data/lib/cucumber/wire_support/wire_packet.rb +0 -34
- data/lib/cucumber/wire_support/wire_protocol.rb +0 -43
- data/lib/cucumber/wire_support/wire_protocol/requests.rb +0 -133
- data/lib/cucumber/wire_support/wire_step_definition.rb +0 -21
- data/spec/cucumber/events/bus_spec.rb +0 -94
- data/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb +0 -22
- data/spec/cucumber/wire_support/configuration_spec.rb +0 -64
- data/spec/cucumber/wire_support/connection_spec.rb +0 -64
- data/spec/cucumber/wire_support/wire_exception_spec.rb +0 -50
- data/spec/cucumber/wire_support/wire_language_spec.rb +0 -46
- data/spec/cucumber/wire_support/wire_packet_spec.rb +0 -44
@@ -6,7 +6,7 @@ module Cucumber
|
|
6
6
|
describe RbStepDefinition do
|
7
7
|
let(:user_interface) { double('user interface') }
|
8
8
|
let(:support_code) { Cucumber::Runtime::SupportCode.new(user_interface) }
|
9
|
-
let(:rb) { support_code.
|
9
|
+
let(:rb) { support_code.ruby }
|
10
10
|
let(:scenario) { double('scenario', iso_code: 'en').as_null_object }
|
11
11
|
let(:dsl) do
|
12
12
|
rb
|
@@ -23,7 +23,7 @@ module Cucumber
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def step_match(text)
|
26
|
-
|
26
|
+
StepMatchSearch.new(rb.method(:step_matches), Configuration.default).call(text).first
|
27
27
|
end
|
28
28
|
|
29
29
|
it "allows calling of other steps" do
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'cucumber/formatter/spec_helper'
|
3
|
+
require 'cucumber/formatter/pretty'
|
4
|
+
|
5
|
+
module Cucumber
|
6
|
+
module RbSupport
|
7
|
+
describe RbWorld do
|
8
|
+
extend Cucumber::Formatter::SpecHelperDsl
|
9
|
+
include Cucumber::Formatter::SpecHelper
|
10
|
+
|
11
|
+
describe 'Handling puts in step definitions' do
|
12
|
+
before(:each) do
|
13
|
+
Cucumber::Term::ANSIColor.coloring = false
|
14
|
+
@out = StringIO.new
|
15
|
+
@formatter = Cucumber::Formatter::Pretty.new(runtime, @out, {})
|
16
|
+
run_defined_feature
|
17
|
+
end
|
18
|
+
|
19
|
+
describe 'when modifying the printed variable after the call to puts' do
|
20
|
+
define_feature <<-FEATURE
|
21
|
+
Feature: Banana party
|
22
|
+
|
23
|
+
Scenario: Monkey eats banana
|
24
|
+
When puts is called twice for the same variable
|
25
|
+
FEATURE
|
26
|
+
|
27
|
+
define_steps do
|
28
|
+
When(/^puts is called twice for the same variable$/) do
|
29
|
+
foo = 'a'
|
30
|
+
puts foo
|
31
|
+
foo.upcase!
|
32
|
+
puts foo
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'prints the variable value at the time puts was called' do
|
37
|
+
expect( @out.string ).to include <<OUTPUT
|
38
|
+
When puts is called twice for the same variable
|
39
|
+
a
|
40
|
+
A
|
41
|
+
OUTPUT
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -4,7 +4,7 @@ module Cucumber
|
|
4
4
|
describe Runtime::ForProgrammingLanguages do
|
5
5
|
|
6
6
|
let(:user_interface) { double('user interface') }
|
7
|
-
subject { Runtime::SupportCode.new(user_interface
|
7
|
+
subject { Runtime::SupportCode.new(user_interface) }
|
8
8
|
let(:runtime_facade) { Runtime::ForProgrammingLanguages.new(subject, user_interface) }
|
9
9
|
|
10
10
|
describe "#doc_string" do
|
@@ -3,121 +3,14 @@ require 'spec_helper'
|
|
3
3
|
module Cucumber
|
4
4
|
describe Runtime::SupportCode do
|
5
5
|
let(:user_interface) { double('user interface') }
|
6
|
-
subject { Runtime::SupportCode.new(user_interface,
|
7
|
-
let(:
|
6
|
+
subject { Runtime::SupportCode.new(user_interface, configuration) }
|
7
|
+
let(:configuration) { Configuration.new(options) }
|
8
|
+
let(:options) { {}}
|
8
9
|
let(:dsl) do
|
9
|
-
@rb = subject.
|
10
|
+
@rb = subject.ruby
|
10
11
|
Object.new.extend(RbSupport::RbDsl)
|
11
12
|
end
|
12
13
|
|
13
|
-
it "formats step names" do
|
14
|
-
dsl.Given(/it (.*) in (.*)/) { |what, month| }
|
15
|
-
dsl.Given(/nope something else/) { |what, month| }
|
16
14
|
|
17
|
-
format = subject.step_match("it snows in april").format_args("[%s]")
|
18
|
-
|
19
|
-
expect(format).to eq "it [snows] in [april]"
|
20
|
-
end
|
21
|
-
|
22
|
-
it "caches step match results" do
|
23
|
-
dsl.Given(/it (.*) in (.*)/) { |what, month| }
|
24
|
-
|
25
|
-
step_match = subject.step_match("it snows in april")
|
26
|
-
|
27
|
-
expect(@rb).not_to receive(:step_matches)
|
28
|
-
second_step_match = subject.step_match("it snows in april")
|
29
|
-
|
30
|
-
expect(step_match).to equal(second_step_match)
|
31
|
-
end
|
32
|
-
|
33
|
-
describe "resolving step defintion matches" do
|
34
|
-
|
35
|
-
it "raises Ambiguous error with guess hint when multiple step definitions match" do
|
36
|
-
expected_error = %{Ambiguous match of "Three blind mice":
|
37
|
-
|
38
|
-
spec/cucumber/runtime/support_code_spec.rb:\\d+:in `/Three (.*) mice/'
|
39
|
-
spec/cucumber/runtime/support_code_spec.rb:\\d+:in `/Three blind (.*)/'
|
40
|
-
|
41
|
-
You can run again with --guess to make Cucumber be more smart about it
|
42
|
-
}
|
43
|
-
dsl.Given(/Three (.*) mice/) {|disability|}
|
44
|
-
dsl.Given(/Three blind (.*)/) {|animal|}
|
45
|
-
|
46
|
-
expect(-> {
|
47
|
-
subject.step_match("Three blind mice")
|
48
|
-
}).to raise_error(Ambiguous, /#{expected_error}/)
|
49
|
-
end
|
50
|
-
|
51
|
-
describe "when --guess is used" do
|
52
|
-
let(:options) { {:guess => true} }
|
53
|
-
|
54
|
-
it "does not show --guess hint" do
|
55
|
-
expected_error = %{Ambiguous match of "Three cute mice":
|
56
|
-
|
57
|
-
spec/cucumber/runtime/support_code_spec.rb:\\d+:in `/Three (.*) mice/'
|
58
|
-
spec/cucumber/runtime/support_code_spec.rb:\\d+:in `/Three cute (.*)/'
|
59
|
-
|
60
|
-
}
|
61
|
-
dsl.Given(/Three (.*) mice/) {|disability|}
|
62
|
-
dsl.Given(/Three cute (.*)/) {|animal|}
|
63
|
-
|
64
|
-
expect(-> {
|
65
|
-
subject.step_match("Three cute mice")
|
66
|
-
}).to raise_error(Ambiguous, /#{expected_error}/)
|
67
|
-
end
|
68
|
-
|
69
|
-
it "does not raise Ambiguous error when multiple step definitions match" do
|
70
|
-
dsl.Given(/Three (.*) mice/) {|disability|}
|
71
|
-
dsl.Given(/Three (.*)/) {|animal|}
|
72
|
-
|
73
|
-
expect(-> {
|
74
|
-
subject.step_match("Three blind mice")
|
75
|
-
}).not_to raise_error
|
76
|
-
end
|
77
|
-
|
78
|
-
it "does not raise NoMethodError when guessing from multiple step definitions with nil fields" do
|
79
|
-
dsl.Given(/Three (.*) mice( cannot find food)?/) {|disability, is_disastrous|}
|
80
|
-
dsl.Given(/Three (.*)?/) {|animal|}
|
81
|
-
|
82
|
-
expect(-> {
|
83
|
-
subject.step_match("Three blind mice")
|
84
|
-
}).not_to raise_error
|
85
|
-
end
|
86
|
-
|
87
|
-
it "picks right step definition when an equal number of capture groups" do
|
88
|
-
right = dsl.Given(/Three (.*) mice/) {|disability|}
|
89
|
-
wrong = dsl.Given(/Three (.*)/) {|animal|}
|
90
|
-
|
91
|
-
expect(subject.step_match("Three blind mice").step_definition).to eq right
|
92
|
-
end
|
93
|
-
|
94
|
-
it "picks right step definition when an unequal number of capture groups" do
|
95
|
-
right = dsl.Given(/Three (.*) mice ran (.*)/) {|disability|}
|
96
|
-
wrong = dsl.Given(/Three (.*)/) {|animal|}
|
97
|
-
|
98
|
-
expect(subject.step_match("Three blind mice ran far").step_definition).to eq right
|
99
|
-
end
|
100
|
-
|
101
|
-
it "picks most specific step definition when an unequal number of capture groups" do
|
102
|
-
general = dsl.Given(/Three (.*) mice ran (.*)/) {|disability|}
|
103
|
-
specific = dsl.Given(/Three blind mice ran far/) do; end
|
104
|
-
more_specific = dsl.Given(/^Three blind mice ran far$/) do; end
|
105
|
-
|
106
|
-
expect(subject.step_match("Three blind mice ran far").step_definition).to eq more_specific
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
it "raises Undefined error when no step definitions match" do
|
111
|
-
expect(-> {
|
112
|
-
subject.step_match("Three blind mice")
|
113
|
-
}).to raise_error(Undefined)
|
114
|
-
end
|
115
|
-
|
116
|
-
# http://railsforum.com/viewtopic.php?pid=93881
|
117
|
-
it "does not raise Redundant unless it's really redundant" do
|
118
|
-
dsl.Given(/^(.*) (.*) user named '(.*)'$/) {|a,b,c|}
|
119
|
-
dsl.Given(/^there is no (.*) user named '(.*)'$/) {|a,b|}
|
120
|
-
end
|
121
|
-
end
|
122
15
|
end
|
123
16
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'cucumber/step_argument'
|
3
|
+
|
4
|
+
module Cucumber
|
5
|
+
describe StepArgument do
|
6
|
+
it "creates 2 arguments" do
|
7
|
+
arguments = StepArgument.arguments_from(/I (\w+) (\w+)/, "I like fish")
|
8
|
+
|
9
|
+
expect(arguments.map{|argument| [argument.val, argument.offset]}).to eq [["like", 2], ["fish", 7]]
|
10
|
+
end
|
11
|
+
|
12
|
+
it "creates 2 arguments when first group is optional" do
|
13
|
+
arguments = StepArgument.arguments_from(/should( not)? be flashed '([^']*?)'$/, "I should be flashed 'Login failed.'")
|
14
|
+
|
15
|
+
expect(arguments.map{|argument| [argument.val, argument.offset]}).to eq [[nil, nil], ["Login failed.", 21]]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
require 'cucumber/step_match_search'
|
2
|
+
require 'cucumber/rb_support/rb_dsl'
|
3
|
+
require 'cucumber/rb_support/rb_language'
|
4
|
+
require 'cucumber/configuration'
|
5
|
+
|
6
|
+
module Cucumber
|
7
|
+
describe StepMatchSearch do
|
8
|
+
|
9
|
+
let(:search) { StepMatchSearch.new(rb_language.method(:step_matches), configuration) }
|
10
|
+
let(:rb_language) { RbSupport::RbLanguage.new(runtime, configuration) }
|
11
|
+
let(:runtime) do
|
12
|
+
# TODO: break out step definitions collection from RbLanguage so we don't need this
|
13
|
+
:unused
|
14
|
+
end
|
15
|
+
let(:configuration) { Configuration.new(options) }
|
16
|
+
let(:options) { {} }
|
17
|
+
let(:dsl) do
|
18
|
+
# TODO: stop relying on implicit global state
|
19
|
+
rb_language
|
20
|
+
Object.new.extend(RbSupport::RbDsl)
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'caching' do
|
24
|
+
it "caches step match results" do
|
25
|
+
dsl.Given(/it (.*) in (.*)/) { |what, month| }
|
26
|
+
|
27
|
+
step_match = search.call("it snows in april").first
|
28
|
+
|
29
|
+
expect(rb_language).not_to receive(:step_matches)
|
30
|
+
second_step_match = search.call("it snows in april").first
|
31
|
+
|
32
|
+
expect(step_match).to equal(second_step_match)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "resolving step defintion matches" do
|
37
|
+
|
38
|
+
it "raises Ambiguous error with guess hint when multiple step definitions match" do
|
39
|
+
expected_error = %{Ambiguous match of "Three blind mice":
|
40
|
+
|
41
|
+
spec/cucumber/step_match_search_spec.rb:\\d+:in `/Three (.*) mice/'
|
42
|
+
spec/cucumber/step_match_search_spec.rb:\\d+:in `/Three blind (.*)/'
|
43
|
+
|
44
|
+
You can run again with --guess to make Cucumber be more smart about it
|
45
|
+
}
|
46
|
+
dsl.Given(/Three (.*) mice/) {|disability|}
|
47
|
+
dsl.Given(/Three blind (.*)/) {|animal|}
|
48
|
+
|
49
|
+
expect(-> {
|
50
|
+
search.call("Three blind mice").first
|
51
|
+
}).to raise_error(Ambiguous, /#{expected_error}/)
|
52
|
+
end
|
53
|
+
|
54
|
+
describe "when --guess is used" do
|
55
|
+
let(:options) { {:guess => true} }
|
56
|
+
|
57
|
+
it "does not show --guess hint" do
|
58
|
+
expected_error = %{Ambiguous match of "Three cute mice":
|
59
|
+
|
60
|
+
spec/cucumber/step_match_search_spec.rb:\\d+:in `/Three (.*) mice/'
|
61
|
+
spec/cucumber/step_match_search_spec.rb:\\d+:in `/Three cute (.*)/'
|
62
|
+
|
63
|
+
}
|
64
|
+
dsl.Given(/Three (.*) mice/) {|disability|}
|
65
|
+
dsl.Given(/Three cute (.*)/) {|animal|}
|
66
|
+
|
67
|
+
expect(-> {
|
68
|
+
search.call("Three cute mice").first
|
69
|
+
}).to raise_error(Ambiguous, /#{expected_error}/)
|
70
|
+
end
|
71
|
+
|
72
|
+
it "does not raise Ambiguous error when multiple step definitions match" do
|
73
|
+
dsl.Given(/Three (.*) mice/) {|disability|}
|
74
|
+
dsl.Given(/Three (.*)/) {|animal|}
|
75
|
+
|
76
|
+
expect(-> {
|
77
|
+
search.call("Three blind mice").first
|
78
|
+
}).not_to raise_error
|
79
|
+
end
|
80
|
+
|
81
|
+
it "does not raise NoMethodError when guessing from multiple step definitions with nil fields" do
|
82
|
+
dsl.Given(/Three (.*) mice( cannot find food)?/) {|disability, is_disastrous|}
|
83
|
+
dsl.Given(/Three (.*)?/) {|animal|}
|
84
|
+
|
85
|
+
expect(-> {
|
86
|
+
search.call("Three blind mice").first
|
87
|
+
}).not_to raise_error
|
88
|
+
end
|
89
|
+
|
90
|
+
it "picks right step definition when an equal number of capture groups" do
|
91
|
+
right = dsl.Given(/Three (.*) mice/) {|disability|}
|
92
|
+
wrong = dsl.Given(/Three (.*)/) {|animal|}
|
93
|
+
|
94
|
+
expect(search.call("Three blind mice").first.step_definition).to eq right
|
95
|
+
end
|
96
|
+
|
97
|
+
it "picks right step definition when an unequal number of capture groups" do
|
98
|
+
right = dsl.Given(/Three (.*) mice ran (.*)/) {|disability|}
|
99
|
+
wrong = dsl.Given(/Three (.*)/) {|animal|}
|
100
|
+
|
101
|
+
expect(search.call("Three blind mice ran far").first.step_definition).to eq right
|
102
|
+
end
|
103
|
+
|
104
|
+
it "picks most specific step definition when an unequal number of capture groups" do
|
105
|
+
general = dsl.Given(/Three (.*) mice ran (.*)/) {|disability|}
|
106
|
+
specific = dsl.Given(/Three blind mice ran far/) do; end
|
107
|
+
more_specific = dsl.Given(/^Three blind mice ran far$/) do; end
|
108
|
+
|
109
|
+
expect(search.call("Three blind mice ran far").first.step_definition).to eq more_specific
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# TODO: remove this - it's ... redundant
|
114
|
+
# http://railsforum.com/viewtopic.php?pid=93881
|
115
|
+
it "does not raise Redundant unless it's really redundant" do
|
116
|
+
dsl.Given(/^(.*) (.*) user named '(.*)'$/) {|a,b,c|}
|
117
|
+
dsl.Given(/^there is no (.*) user named '(.*)'$/) {|a,b|}
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
@@ -8,7 +8,7 @@ module Cucumber
|
|
8
8
|
WORD = '[[:word:]]'
|
9
9
|
|
10
10
|
before do
|
11
|
-
@rb_language = RbSupport::RbLanguage.new(nil)
|
11
|
+
@rb_language = RbSupport::RbLanguage.new(nil, Configuration.new)
|
12
12
|
end
|
13
13
|
|
14
14
|
def stepdef(regexp)
|
@@ -17,7 +17,13 @@ module Cucumber
|
|
17
17
|
|
18
18
|
def step_match(regexp, name)
|
19
19
|
stepdef = stepdef(regexp)
|
20
|
-
StepMatch.new(stepdef, name,
|
20
|
+
StepMatch.new(stepdef, name, stepdef.arguments_from(name))
|
21
|
+
end
|
22
|
+
|
23
|
+
it "formats step names" do
|
24
|
+
m = step_match(/it (.*) in (.*)/, "it snows in april")
|
25
|
+
format = m.format_args("[%s]")
|
26
|
+
expect(format).to eq "it [snows] in [april]"
|
21
27
|
end
|
22
28
|
|
23
29
|
it "formats one group when we use Unicode" do
|
@@ -1,10 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'cucumber/rb_support/rb_language'
|
3
|
+
require 'cucumber/configuration'
|
3
4
|
|
4
5
|
module Cucumber
|
5
6
|
describe 'Pending' do
|
6
7
|
before(:each) do
|
7
|
-
l = RbSupport::RbLanguage.new(Runtime.new)
|
8
|
+
l = RbSupport::RbLanguage.new(Runtime.new, Configuration.new)
|
8
9
|
l.begin_rb_scenario(double('scenario').as_null_object)
|
9
10
|
@world = l.current_world
|
10
11
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'cucumber'
|
2
|
+
|
3
|
+
describe Cucumber do
|
4
|
+
|
5
|
+
# Implementation is backported from ruby 2.0 when cucumber is used on ruby 1.9.
|
6
|
+
# The tests will run on all implementations to ensure we have the same
|
7
|
+
# feature set.
|
8
|
+
describe 'Hash' do
|
9
|
+
it "converts nil to empty {}" do
|
10
|
+
expect(Cucumber::Hash(nil)).to eq({})
|
11
|
+
end
|
12
|
+
|
13
|
+
it "converts [] to {}" do
|
14
|
+
expect(Cucumber::Hash([])).to eq({})
|
15
|
+
end
|
16
|
+
|
17
|
+
it "converts a hash to an equivalent hash" do
|
18
|
+
original = {:a => 1, :b => 2}
|
19
|
+
expect(Cucumber::Hash(original)).to eq({a: 1, b: 2})
|
20
|
+
end
|
21
|
+
|
22
|
+
it "converts an object with a to_hash method" do
|
23
|
+
original = Object.new
|
24
|
+
def original.to_hash
|
25
|
+
{key: "value"}
|
26
|
+
end
|
27
|
+
|
28
|
+
expect(Cucumber::Hash(original)).to eq({key: "value"})
|
29
|
+
end
|
30
|
+
|
31
|
+
it "raises a TypeError for an object that does not have .to_hash" do
|
32
|
+
original = %w(cannot convert to hash)
|
33
|
+
|
34
|
+
expect { Cucumber::Hash(original) }.to raise_error TypeError
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aslak Hellesøy
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2016-01-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: cucumber-core
|
@@ -102,6 +102,34 @@ dependencies:
|
|
102
102
|
- - ">="
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: 0.1.2
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
name: cucumber-wire
|
107
|
+
requirement: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 0.0.1
|
112
|
+
type: :runtime
|
113
|
+
prerelease: false
|
114
|
+
version_requirements: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: 0.0.1
|
119
|
+
- !ruby/object:Gem::Dependency
|
120
|
+
name: event-bus
|
121
|
+
requirement: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.1.0
|
126
|
+
type: :runtime
|
127
|
+
prerelease: false
|
128
|
+
version_requirements: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - "~>"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 0.1.0
|
105
133
|
- !ruby/object:Gem::Dependency
|
106
134
|
name: aruba
|
107
135
|
requirement: !ruby/object:Gem::Requirement
|
@@ -592,6 +620,7 @@ files:
|
|
592
620
|
- features/docs/exception_in_before_hook.feature
|
593
621
|
- features/docs/extending_cucumber/custom_filter.feature
|
594
622
|
- features/docs/extending_cucumber/custom_formatter.feature
|
623
|
+
- features/docs/formatters/api_methods.feature
|
595
624
|
- features/docs/formatters/debug_formatter.feature
|
596
625
|
- features/docs/formatters/formatter_step_file_colon_line.feature
|
597
626
|
- features/docs/formatters/html_formatter.feature
|
@@ -616,15 +645,6 @@ files:
|
|
616
645
|
- features/docs/profiles.feature
|
617
646
|
- features/docs/rake_task.feature
|
618
647
|
- features/docs/raketask.feature
|
619
|
-
- features/docs/wire_protocol/erb_configuration.feature
|
620
|
-
- features/docs/wire_protocol/handle_unexpected_response.feature
|
621
|
-
- features/docs/wire_protocol/invoke_message.feature
|
622
|
-
- features/docs/wire_protocol/readme.md
|
623
|
-
- features/docs/wire_protocol/snippets_message.feature
|
624
|
-
- features/docs/wire_protocol/step_matches_message.feature
|
625
|
-
- features/docs/wire_protocol/table_diffing.feature
|
626
|
-
- features/docs/wire_protocol/tags.feature
|
627
|
-
- features/docs/wire_protocol/timeouts.feature
|
628
648
|
- features/docs/work_in_progress.feature
|
629
649
|
- features/docs/writing_support_code/after_hooks.feature
|
630
650
|
- features/docs/writing_support_code/around_hooks.feature
|
@@ -677,6 +697,7 @@ files:
|
|
677
697
|
- lib/cucumber/constantize.rb
|
678
698
|
- lib/cucumber/core_ext/instance_exec.rb
|
679
699
|
- lib/cucumber/core_ext/string.rb
|
700
|
+
- lib/cucumber/deprecate.rb
|
680
701
|
- lib/cucumber/encoding.rb
|
681
702
|
- lib/cucumber/errors.rb
|
682
703
|
- lib/cucumber/events.rb
|
@@ -684,7 +705,6 @@ files:
|
|
684
705
|
- lib/cucumber/events/after_test_step.rb
|
685
706
|
- lib/cucumber/events/before_test_case.rb
|
686
707
|
- lib/cucumber/events/before_test_step.rb
|
687
|
-
- lib/cucumber/events/bus.rb
|
688
708
|
- lib/cucumber/events/step_match.rb
|
689
709
|
- lib/cucumber/file_specs.rb
|
690
710
|
- lib/cucumber/filters.rb
|
@@ -734,14 +754,10 @@ files:
|
|
734
754
|
- lib/cucumber/formatter/usage.rb
|
735
755
|
- lib/cucumber/gherkin/data_table_parser.rb
|
736
756
|
- lib/cucumber/gherkin/formatter/ansi_escapes.rb
|
737
|
-
- lib/cucumber/gherkin/formatter/argument.rb
|
738
757
|
- lib/cucumber/gherkin/formatter/escaping.rb
|
739
|
-
- lib/cucumber/gherkin/formatter/hashable.rb
|
740
758
|
- lib/cucumber/gherkin/i18n.rb
|
741
759
|
- lib/cucumber/gherkin/steps_parser.rb
|
742
760
|
- lib/cucumber/hooks.rb
|
743
|
-
- lib/cucumber/language_support.rb
|
744
|
-
- lib/cucumber/language_support/language_methods.rb
|
745
761
|
- lib/cucumber/load_path.rb
|
746
762
|
- lib/cucumber/multiline_argument.rb
|
747
763
|
- lib/cucumber/multiline_argument/data_table.rb
|
@@ -755,7 +771,6 @@ files:
|
|
755
771
|
- lib/cucumber/rb_support/rb_step_definition.rb
|
756
772
|
- lib/cucumber/rb_support/rb_transform.rb
|
757
773
|
- lib/cucumber/rb_support/rb_world.rb
|
758
|
-
- lib/cucumber/rb_support/regexp_argument_matcher.rb
|
759
774
|
- lib/cucumber/rb_support/snippet.rb
|
760
775
|
- lib/cucumber/rspec/disable_option_parser.rb
|
761
776
|
- lib/cucumber/rspec/doubles.rb
|
@@ -767,20 +782,14 @@ files:
|
|
767
782
|
- lib/cucumber/runtime/step_hooks.rb
|
768
783
|
- lib/cucumber/runtime/support_code.rb
|
769
784
|
- lib/cucumber/runtime/user_interface.rb
|
785
|
+
- lib/cucumber/step_argument.rb
|
770
786
|
- lib/cucumber/step_definition_light.rb
|
771
787
|
- lib/cucumber/step_definitions.rb
|
772
788
|
- lib/cucumber/step_match.rb
|
789
|
+
- lib/cucumber/step_match_search.rb
|
773
790
|
- lib/cucumber/term/ansicolor.rb
|
774
791
|
- lib/cucumber/unit.rb
|
775
|
-
- lib/cucumber/
|
776
|
-
- lib/cucumber/wire_support/connection.rb
|
777
|
-
- lib/cucumber/wire_support/request_handler.rb
|
778
|
-
- lib/cucumber/wire_support/wire_exception.rb
|
779
|
-
- lib/cucumber/wire_support/wire_language.rb
|
780
|
-
- lib/cucumber/wire_support/wire_packet.rb
|
781
|
-
- lib/cucumber/wire_support/wire_protocol.rb
|
782
|
-
- lib/cucumber/wire_support/wire_protocol/requests.rb
|
783
|
-
- lib/cucumber/wire_support/wire_step_definition.rb
|
792
|
+
- lib/cucumber/version
|
784
793
|
- lib/simplecov_setup.rb
|
785
794
|
- spec/cucumber/cli/configuration_spec.rb
|
786
795
|
- spec/cucumber/cli/main_spec.rb
|
@@ -790,7 +799,6 @@ files:
|
|
790
799
|
- spec/cucumber/configuration_spec.rb
|
791
800
|
- spec/cucumber/constantize_spec.rb
|
792
801
|
- spec/cucumber/core_ext/instance_exec_spec.rb
|
793
|
-
- spec/cucumber/events/bus_spec.rb
|
794
802
|
- spec/cucumber/file_specs_spec.rb
|
795
803
|
- spec/cucumber/filters/activate_steps_spec.rb
|
796
804
|
- spec/cucumber/filters/gated_receiver_spec.rb
|
@@ -818,20 +826,18 @@ files:
|
|
818
826
|
- spec/cucumber/rb_support/rb_language_spec.rb
|
819
827
|
- spec/cucumber/rb_support/rb_step_definition_spec.rb
|
820
828
|
- spec/cucumber/rb_support/rb_transform_spec.rb
|
821
|
-
- spec/cucumber/rb_support/
|
829
|
+
- spec/cucumber/rb_support/rb_world_spec.rb
|
822
830
|
- spec/cucumber/rb_support/snippet_spec.rb
|
823
831
|
- spec/cucumber/running_test_case_spec.rb
|
824
832
|
- spec/cucumber/runtime/for_programming_languages_spec.rb
|
825
833
|
- spec/cucumber/runtime/support_code_spec.rb
|
826
834
|
- spec/cucumber/runtime_spec.rb
|
827
835
|
- spec/cucumber/sell_cucumbers.feature
|
836
|
+
- spec/cucumber/step_argument_spec.rb
|
837
|
+
- spec/cucumber/step_match_search_spec.rb
|
828
838
|
- spec/cucumber/step_match_spec.rb
|
829
|
-
- spec/cucumber/wire_support/configuration_spec.rb
|
830
|
-
- spec/cucumber/wire_support/connection_spec.rb
|
831
|
-
- spec/cucumber/wire_support/wire_exception_spec.rb
|
832
|
-
- spec/cucumber/wire_support/wire_language_spec.rb
|
833
|
-
- spec/cucumber/wire_support/wire_packet_spec.rb
|
834
839
|
- spec/cucumber/world/pending_spec.rb
|
840
|
+
- spec/cucumber_spec.rb
|
835
841
|
- spec/spec_helper.rb
|
836
842
|
- spec/support/standard_step_actions.rb
|
837
843
|
homepage: http://cukes.info
|
@@ -858,7 +864,7 @@ rubyforge_project:
|
|
858
864
|
rubygems_version: 2.2.2
|
859
865
|
signing_key:
|
860
866
|
specification_version: 4
|
861
|
-
summary: cucumber-2.
|
867
|
+
summary: cucumber-2.2.0
|
862
868
|
test_files:
|
863
869
|
- features/docs/api/list_step_defs_as_json.feature
|
864
870
|
- features/docs/api/listen_for_events.feature
|
@@ -891,6 +897,7 @@ test_files:
|
|
891
897
|
- features/docs/exception_in_before_hook.feature
|
892
898
|
- features/docs/extending_cucumber/custom_filter.feature
|
893
899
|
- features/docs/extending_cucumber/custom_formatter.feature
|
900
|
+
- features/docs/formatters/api_methods.feature
|
894
901
|
- features/docs/formatters/debug_formatter.feature
|
895
902
|
- features/docs/formatters/formatter_step_file_colon_line.feature
|
896
903
|
- features/docs/formatters/html_formatter.feature
|
@@ -915,15 +922,6 @@ test_files:
|
|
915
922
|
- features/docs/profiles.feature
|
916
923
|
- features/docs/rake_task.feature
|
917
924
|
- features/docs/raketask.feature
|
918
|
-
- features/docs/wire_protocol/erb_configuration.feature
|
919
|
-
- features/docs/wire_protocol/handle_unexpected_response.feature
|
920
|
-
- features/docs/wire_protocol/invoke_message.feature
|
921
|
-
- features/docs/wire_protocol/readme.md
|
922
|
-
- features/docs/wire_protocol/snippets_message.feature
|
923
|
-
- features/docs/wire_protocol/step_matches_message.feature
|
924
|
-
- features/docs/wire_protocol/table_diffing.feature
|
925
|
-
- features/docs/wire_protocol/tags.feature
|
926
|
-
- features/docs/wire_protocol/timeouts.feature
|
927
925
|
- features/docs/work_in_progress.feature
|
928
926
|
- features/docs/writing_support_code/after_hooks.feature
|
929
927
|
- features/docs/writing_support_code/around_hooks.feature
|
@@ -953,7 +951,6 @@ test_files:
|
|
953
951
|
- spec/cucumber/configuration_spec.rb
|
954
952
|
- spec/cucumber/constantize_spec.rb
|
955
953
|
- spec/cucumber/core_ext/instance_exec_spec.rb
|
956
|
-
- spec/cucumber/events/bus_spec.rb
|
957
954
|
- spec/cucumber/file_specs_spec.rb
|
958
955
|
- spec/cucumber/filters/activate_steps_spec.rb
|
959
956
|
- spec/cucumber/filters/gated_receiver_spec.rb
|
@@ -981,20 +978,18 @@ test_files:
|
|
981
978
|
- spec/cucumber/rb_support/rb_language_spec.rb
|
982
979
|
- spec/cucumber/rb_support/rb_step_definition_spec.rb
|
983
980
|
- spec/cucumber/rb_support/rb_transform_spec.rb
|
984
|
-
- spec/cucumber/rb_support/
|
981
|
+
- spec/cucumber/rb_support/rb_world_spec.rb
|
985
982
|
- spec/cucumber/rb_support/snippet_spec.rb
|
986
983
|
- spec/cucumber/running_test_case_spec.rb
|
987
984
|
- spec/cucumber/runtime/for_programming_languages_spec.rb
|
988
985
|
- spec/cucumber/runtime/support_code_spec.rb
|
989
986
|
- spec/cucumber/runtime_spec.rb
|
990
987
|
- spec/cucumber/sell_cucumbers.feature
|
988
|
+
- spec/cucumber/step_argument_spec.rb
|
989
|
+
- spec/cucumber/step_match_search_spec.rb
|
991
990
|
- spec/cucumber/step_match_spec.rb
|
992
|
-
- spec/cucumber/wire_support/configuration_spec.rb
|
993
|
-
- spec/cucumber/wire_support/connection_spec.rb
|
994
|
-
- spec/cucumber/wire_support/wire_exception_spec.rb
|
995
|
-
- spec/cucumber/wire_support/wire_language_spec.rb
|
996
|
-
- spec/cucumber/wire_support/wire_packet_spec.rb
|
997
991
|
- spec/cucumber/world/pending_spec.rb
|
992
|
+
- spec/cucumber_spec.rb
|
998
993
|
- spec/spec_helper.rb
|
999
994
|
- spec/support/standard_step_actions.rb
|
1000
995
|
has_rdoc:
|