cucumber 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +32 -30
- data/History.md +8 -0
- data/cucumber.gemspec +7 -7
- data/features/doc_strings.feature +73 -0
- data/features/json_formatter.feature +10 -9
- data/features/step_definitions/cucumber-features/cucumber_ruby_mappings.rb +3 -3
- data/features/step_definitions/cucumber_steps.rb +15 -0
- data/features/support/feature_factory.rb +50 -0
- data/legacy_features/language_help.feature +1 -0
- data/lib/cucumber/ast/doc_string.rb +10 -29
- data/lib/cucumber/ast/multiline_argument.rb +30 -0
- data/lib/cucumber/formatter/html.rb +1 -1
- data/lib/cucumber/parser/gherkin_builder.rb +10 -11
- data/lib/cucumber/platform.rb +1 -1
- data/lib/cucumber/runtime/support_code.rb +14 -19
- data/lib/cucumber/step_match.rb +0 -1
- data/spec/cucumber/ast/doc_string_spec.rb +2 -2
- data/spec/cucumber/ast/feature_factory.rb +1 -1
- data/spec/cucumber/ast/step_spec.rb +1 -1
- metadata +17 -13
- data/.yardopts +0 -0
data/Gemfile.lock
CHANGED
@@ -1,56 +1,57 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cucumber (1.0.
|
4
|
+
cucumber (1.0.2)
|
5
5
|
builder (>= 2.1.2)
|
6
6
|
diff-lcs (>= 1.1.2)
|
7
|
-
gherkin (~> 2.4.
|
7
|
+
gherkin (~> 2.4.18)
|
8
8
|
json (>= 1.4.6)
|
9
|
-
term-ansicolor (>= 1.0.
|
9
|
+
term-ansicolor (>= 1.0.6)
|
10
10
|
|
11
11
|
GEM
|
12
12
|
remote: http://rubygems.org/
|
13
13
|
specs:
|
14
|
-
aruba (0.4.
|
14
|
+
aruba (0.4.6)
|
15
15
|
bcat (>= 0.6.1)
|
16
|
-
childprocess (>= 0.
|
17
|
-
cucumber (>= 0.
|
16
|
+
childprocess (>= 0.2.0)
|
17
|
+
cucumber (>= 1.0.2)
|
18
18
|
rdiscount (>= 1.6.8)
|
19
19
|
rspec (>= 2.6.0)
|
20
20
|
bcat (0.6.1)
|
21
21
|
rack (~> 1.0)
|
22
22
|
builder (3.0.0)
|
23
|
-
capybara (1.
|
23
|
+
capybara (1.1.0)
|
24
24
|
mime-types (>= 1.16)
|
25
25
|
nokogiri (>= 1.3.3)
|
26
26
|
rack (>= 1.0.0)
|
27
27
|
rack-test (>= 0.5.4)
|
28
|
-
selenium-webdriver (~>
|
28
|
+
selenium-webdriver (~> 2.0)
|
29
29
|
xpath (~> 0.1.4)
|
30
|
-
childprocess (0.
|
30
|
+
childprocess (0.2.2)
|
31
31
|
ffi (~> 1.0.6)
|
32
|
-
diff-lcs (1.1.
|
32
|
+
diff-lcs (1.1.3)
|
33
33
|
ffi (1.0.9)
|
34
|
-
gherkin (2.4.
|
34
|
+
gherkin (2.4.18)
|
35
35
|
json (>= 1.4.6)
|
36
36
|
innate (2011.04)
|
37
37
|
rack (>= 1.1.0)
|
38
|
-
json (1.5.
|
39
|
-
json_pure (1.5.
|
38
|
+
json (1.5.4)
|
39
|
+
json_pure (1.5.4)
|
40
|
+
spruz (~> 0.2.8)
|
40
41
|
mime-types (1.16)
|
41
42
|
nokogiri (1.5.0)
|
42
43
|
prawn (0.8.4)
|
43
|
-
prawn-core (
|
44
|
-
prawn-layout (
|
45
|
-
prawn-security (
|
44
|
+
prawn-core (>= 0.8.4, < 0.9)
|
45
|
+
prawn-layout (>= 0.8.4, < 0.9)
|
46
|
+
prawn-security (>= 0.8.4, < 0.9)
|
46
47
|
prawn-core (0.8.4)
|
47
48
|
prawn-layout (0.8.4)
|
48
49
|
prawn-security (0.8.4)
|
49
|
-
rack (1.3.
|
50
|
-
rack-test (0.6.
|
50
|
+
rack (1.3.2)
|
51
|
+
rack-test (0.6.1)
|
51
52
|
rack (>= 1.0)
|
52
53
|
rake (0.9.2)
|
53
|
-
ramaze (2011.
|
54
|
+
ramaze (2011.07.25)
|
54
55
|
innate (>= 2010.03)
|
55
56
|
rdiscount (1.6.8)
|
56
57
|
rspec (2.6.0)
|
@@ -62,8 +63,8 @@ GEM
|
|
62
63
|
diff-lcs (~> 1.1.2)
|
63
64
|
rspec-mocks (2.6.0)
|
64
65
|
rubyzip (0.9.4)
|
65
|
-
selenium-webdriver (
|
66
|
-
childprocess (>= 0.1
|
66
|
+
selenium-webdriver (2.5.0)
|
67
|
+
childprocess (>= 0.2.1)
|
67
68
|
ffi (>= 1.0.7)
|
68
69
|
json_pure
|
69
70
|
rubyzip
|
@@ -72,28 +73,29 @@ GEM
|
|
72
73
|
simplecov-html (0.4.5)
|
73
74
|
sinatra (1.2.6)
|
74
75
|
rack (~> 1.1)
|
75
|
-
tilt (
|
76
|
+
tilt (>= 1.2.2, < 2.0)
|
76
77
|
spork (0.9.0.rc9)
|
78
|
+
spruz (0.2.13)
|
77
79
|
syntax (1.0.0)
|
78
|
-
term-ansicolor (1.0.
|
79
|
-
tilt (1.3.
|
80
|
+
term-ansicolor (1.0.6)
|
81
|
+
tilt (1.3.3)
|
80
82
|
webrat (0.7.3)
|
81
83
|
nokogiri (>= 1.2.0)
|
82
84
|
rack (>= 1.0)
|
83
85
|
rack-test (>= 0.5.3)
|
84
86
|
xpath (0.1.4)
|
85
87
|
nokogiri (~> 1.3)
|
86
|
-
yard (0.7.
|
88
|
+
yard (0.7.2)
|
87
89
|
|
88
90
|
PLATFORMS
|
89
91
|
ruby
|
90
92
|
|
91
93
|
DEPENDENCIES
|
92
|
-
aruba (~> 0.4.
|
94
|
+
aruba (~> 0.4.6)
|
93
95
|
bcat (= 0.6.1)
|
94
|
-
capybara (>= 1.
|
96
|
+
capybara (>= 1.1.0)
|
95
97
|
cucumber!
|
96
|
-
nokogiri (>= 1.
|
98
|
+
nokogiri (>= 1.5.0)
|
97
99
|
prawn (= 0.8.4)
|
98
100
|
prawn-layout (= 0.8.4)
|
99
101
|
rack-test (>= 0.5.7)
|
@@ -103,7 +105,7 @@ DEPENDENCIES
|
|
103
105
|
rspec (>= 2.6.0)
|
104
106
|
simplecov (>= 0.4.2)
|
105
107
|
sinatra (>= 1.2.6)
|
106
|
-
spork (>= 0.9.0.
|
108
|
+
spork (>= 0.9.0.rc9)
|
107
109
|
syntax (>= 1.0.0)
|
108
110
|
webrat (>= 0.7.3)
|
109
|
-
yard (= 0.7.
|
111
|
+
yard (= 0.7.2)
|
data/History.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## [v1.0.3](https://github.com/cucumber/cucumber/compare/v1.0.2...v1.0.3) (In Git)
|
2
|
+
|
3
|
+
### Bugfixes
|
4
|
+
* Do not escape the replaced entity ([#126](https://github.com/cucumber/cucumber/pull/126) Jonathan Tron)
|
5
|
+
|
6
|
+
### New Features
|
7
|
+
* DocStrings now have a content_type ([#132](https://github.com/cucumber/cucumber/issues/132) Matt Wynne)
|
8
|
+
|
1
9
|
## [v1.0.2](https://github.com/cucumber/cucumber/compare/v1.0.1...v1.0.2)
|
2
10
|
|
3
11
|
### Bugfixes
|
data/cucumber.gemspec
CHANGED
@@ -23,24 +23,24 @@ for important information about this release. Happy cuking!
|
|
23
23
|
|
24
24
|
}
|
25
25
|
|
26
|
-
s.add_dependency 'gherkin', '~> 2.4.
|
27
|
-
s.add_dependency 'term-ansicolor', '>= 1.0.
|
26
|
+
s.add_dependency 'gherkin', '~> 2.4.18'
|
27
|
+
s.add_dependency 'term-ansicolor', '>= 1.0.6'
|
28
28
|
s.add_dependency 'builder', '>= 2.1.2'
|
29
29
|
s.add_dependency 'diff-lcs', '>= 1.1.2'
|
30
30
|
s.add_dependency 'json', '>= 1.4.6'
|
31
31
|
|
32
|
-
s.add_development_dependency 'aruba', '~> 0.4.
|
32
|
+
s.add_development_dependency 'aruba', '~> 0.4.6'
|
33
33
|
s.add_development_dependency 'rake', '>= 0.9.2'
|
34
34
|
s.add_development_dependency 'rspec', '>= 2.6.0'
|
35
|
-
s.add_development_dependency 'nokogiri', '>= 1.
|
35
|
+
s.add_development_dependency 'nokogiri', '>= 1.5.0'
|
36
36
|
s.add_development_dependency 'prawn', '= 0.8.4'
|
37
37
|
s.add_development_dependency 'prawn-layout', '= 0.8.4'
|
38
38
|
s.add_development_dependency 'syntax', '>= 1.0.0'
|
39
|
-
s.add_development_dependency 'spork', '>= 0.9.0.
|
39
|
+
s.add_development_dependency 'spork', '>= 0.9.0.rc9'
|
40
40
|
s.add_development_dependency 'simplecov', '>= 0.4.2'
|
41
41
|
|
42
42
|
# For Documentation:
|
43
|
-
s.add_development_dependency('yard', '= 0.7.
|
43
|
+
s.add_development_dependency('yard', '= 0.7.2')
|
44
44
|
s.add_development_dependency('rdiscount', '= 1.6.8')
|
45
45
|
s.add_development_dependency('bcat', '= 0.6.1')
|
46
46
|
|
@@ -49,7 +49,7 @@ for important information about this release. Happy cuking!
|
|
49
49
|
s.add_development_dependency 'rack-test', '>= 0.5.7'
|
50
50
|
s.add_development_dependency 'webrat', '>= 0.7.3'
|
51
51
|
s.add_development_dependency 'sinatra', '>= 1.2.6'
|
52
|
-
s.add_development_dependency 'capybara', '>= 1.
|
52
|
+
s.add_development_dependency 'capybara', '>= 1.1.0'
|
53
53
|
|
54
54
|
s.rubygems_version = ">= 1.6.1"
|
55
55
|
s.files = `git ls-files`.split("\n")
|
@@ -0,0 +1,73 @@
|
|
1
|
+
Feature: Doc strings
|
2
|
+
|
3
|
+
If you need to specify information in a scenario that won't fit on a single line,
|
4
|
+
you can use a DocString.
|
5
|
+
|
6
|
+
A DocString follows a step, and starts and ends with three double quotes, like this:
|
7
|
+
|
8
|
+
```gherkin
|
9
|
+
When I ask to reset my password
|
10
|
+
Then I should receive an email with:
|
11
|
+
"""
|
12
|
+
Dear bozo,
|
13
|
+
|
14
|
+
Please click this link to reset your password
|
15
|
+
"""
|
16
|
+
```
|
17
|
+
|
18
|
+
It's possible to annotate the DocString with the type of content it contains. This is used by
|
19
|
+
formatting tools like http://relishapp.com which will render the contents of the DocString
|
20
|
+
appropriately. You specify the content type after the triple quote, like this:
|
21
|
+
|
22
|
+
```gherkin
|
23
|
+
Given there is some Ruby code:
|
24
|
+
"""ruby
|
25
|
+
puts "hello world"
|
26
|
+
"""
|
27
|
+
|
28
|
+
You can read the content type from the argument passed into your step definition, as shown
|
29
|
+
in the example below.
|
30
|
+
|
31
|
+
Scenario: Plain text Docstring
|
32
|
+
Given a scenario with a step that looks like this:
|
33
|
+
"""gherkin
|
34
|
+
Given I have a lot to say:
|
35
|
+
\"\"\"
|
36
|
+
One
|
37
|
+
Two
|
38
|
+
Three
|
39
|
+
\"\"\"
|
40
|
+
"""
|
41
|
+
And a step definition that looks like this:
|
42
|
+
"""ruby
|
43
|
+
Given /say/ do |text|
|
44
|
+
puts text
|
45
|
+
end
|
46
|
+
"""
|
47
|
+
When I run the feature with the progress formatter
|
48
|
+
Then the output should contain:
|
49
|
+
"""
|
50
|
+
One
|
51
|
+
Two
|
52
|
+
Three
|
53
|
+
"""
|
54
|
+
|
55
|
+
Scenario: DocString with interesting content type
|
56
|
+
Given a scenario with a step that looks like this:
|
57
|
+
"""gherkin
|
58
|
+
Given I have some code for you:
|
59
|
+
\"\"\"ruby
|
60
|
+
# hello
|
61
|
+
\"\"\"
|
62
|
+
"""
|
63
|
+
And a step definition that looks like this:
|
64
|
+
"""ruby
|
65
|
+
Given /code/ do |text|
|
66
|
+
puts text.content_type
|
67
|
+
end
|
68
|
+
"""
|
69
|
+
When I run the feature with the progress formatter
|
70
|
+
Then the output should contain:
|
71
|
+
"""
|
72
|
+
ruby
|
73
|
+
"""
|
@@ -142,10 +142,10 @@ Feature: JSON output formatter
|
|
142
142
|
|
143
143
|
"""
|
144
144
|
|
145
|
-
Scenario:
|
146
|
-
Given a file named "features/
|
145
|
+
Scenario: DocString
|
146
|
+
Given a file named "features/doc_string.feature" with:
|
147
147
|
"""
|
148
|
-
Feature: A
|
148
|
+
Feature: A DocString feature
|
149
149
|
|
150
150
|
Scenario:
|
151
151
|
Then I should fail with
|
@@ -153,20 +153,20 @@ Feature: JSON output formatter
|
|
153
153
|
a string
|
154
154
|
\"\"\"
|
155
155
|
"""
|
156
|
-
And a file named "features/step_definitions/
|
156
|
+
And a file named "features/step_definitions/doc_string_steps.rb" with:
|
157
157
|
"""
|
158
158
|
Then /I should fail with/ do |s|
|
159
159
|
raise s
|
160
160
|
end
|
161
161
|
"""
|
162
|
-
When I run cucumber "--format json features/
|
162
|
+
When I run cucumber "--format json features/doc_string.feature"
|
163
163
|
Then it should fail with JSON:
|
164
164
|
"""
|
165
165
|
{
|
166
166
|
"features": [
|
167
167
|
{
|
168
168
|
"keyword": "Feature",
|
169
|
-
"name": "A
|
169
|
+
"name": "A DocString feature",
|
170
170
|
"line": 1,
|
171
171
|
"description": "",
|
172
172
|
"elements": [
|
@@ -182,16 +182,17 @@ Feature: JSON output formatter
|
|
182
182
|
"name": "I should fail with",
|
183
183
|
"line": 4,
|
184
184
|
"multiline_arg": {
|
185
|
+
"content_type": "",
|
185
186
|
"value": "a string",
|
186
187
|
"line": 5,
|
187
188
|
"type": "doc_string"
|
188
189
|
},
|
189
190
|
"match": {
|
190
|
-
"location": "features/step_definitions/
|
191
|
+
"location": "features/step_definitions/doc_string_steps.rb:1"
|
191
192
|
},
|
192
193
|
"result": {
|
193
194
|
"status": "failed",
|
194
|
-
"error_message": "a string (RuntimeError)\n./features/step_definitions/
|
195
|
+
"error_message": "a string (RuntimeError)\n./features/step_definitions/doc_string_steps.rb:2:in `/I should fail with/'\nfeatures/doc_string.feature:4:in `Then I should fail with'"
|
195
196
|
}
|
196
197
|
}
|
197
198
|
]
|
@@ -245,4 +246,4 @@ Feature: JSON output formatter
|
|
245
246
|
]
|
246
247
|
}
|
247
248
|
|
248
|
-
"""
|
249
|
+
"""
|
@@ -7,8 +7,8 @@ module CucumberRubyMappings
|
|
7
7
|
run_simple "#{cucumber_bin} features/a_feature.feature --name '#{scenario_name}'", false
|
8
8
|
end
|
9
9
|
|
10
|
-
def run_feature
|
11
|
-
run_simple "#{cucumber_bin}
|
10
|
+
def run_feature(filename = 'features/a_feature.feature', formatter = 'progress')
|
11
|
+
run_simple "#{cucumber_bin} #{filename} --format #{formatter}", false
|
12
12
|
end
|
13
13
|
|
14
14
|
def cucumber_bin
|
@@ -54,7 +54,7 @@ EOF
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def write_calculator_code
|
57
|
-
|
57
|
+
code = <<-EOF
|
58
58
|
# http://en.wikipedia.org/wiki/Reverse_Polish_notation
|
59
59
|
class RpnCalculator
|
60
60
|
def initialize
|
@@ -21,3 +21,18 @@ Given /^a directory without standard Cucumber project directory structure$/ do
|
|
21
21
|
FileUtils.rm_rf 'features' if File.directory?('features')
|
22
22
|
end
|
23
23
|
end
|
24
|
+
|
25
|
+
Given /^a scenario with a step that looks like this:$/ do |string|
|
26
|
+
create_feature do
|
27
|
+
create_scenario { string }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
Given /^a step definition that looks like this:$/ do |string|
|
32
|
+
create_step_definition { string }
|
33
|
+
end
|
34
|
+
|
35
|
+
When /^I run the feature with the (\w+) formatter$/ do |formatter|
|
36
|
+
features.length.should == 1
|
37
|
+
run_feature features.first, formatter
|
38
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module FeatureFactory
|
2
|
+
def create_feature(name = generate_feature_name)
|
3
|
+
gherkin = <<-GHERKIN
|
4
|
+
Feature: #{name}
|
5
|
+
#{yield}
|
6
|
+
GHERKIN
|
7
|
+
write_file filename(name), gherkin
|
8
|
+
end
|
9
|
+
|
10
|
+
def create_scenario(name = generate_scenario_name)
|
11
|
+
<<-GHERKIN
|
12
|
+
Scenario: #{name}
|
13
|
+
#{yield}
|
14
|
+
GHERKIN
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_step_definition
|
18
|
+
write_file generate_step_definition_filename, yield
|
19
|
+
end
|
20
|
+
|
21
|
+
def generate_feature_name
|
22
|
+
"Test Feature #{next_increment(:feature)}"
|
23
|
+
end
|
24
|
+
|
25
|
+
def generate_scenario_name
|
26
|
+
"Test Scenario #{next_increment(:scenario)}"
|
27
|
+
end
|
28
|
+
|
29
|
+
def next_increment(label)
|
30
|
+
@increments ||= {}
|
31
|
+
@increments[label] ||= 0
|
32
|
+
@increments[label] += 1
|
33
|
+
end
|
34
|
+
|
35
|
+
def generate_step_definition_filename
|
36
|
+
"features/step_definitions/test_steps#{next_increment(:step_defs)}.rb"
|
37
|
+
end
|
38
|
+
|
39
|
+
def filename(name)
|
40
|
+
"features/#{name.downcase.gsub(' ', '_')}.feature"
|
41
|
+
end
|
42
|
+
|
43
|
+
def features
|
44
|
+
in_current_dir do
|
45
|
+
Dir['features/*.feature']
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
World(FeatureFactory)
|
@@ -16,59 +16,40 @@ module Cucumber
|
|
16
16
|
#
|
17
17
|
# Note how the indentation from the source is stripped away.
|
18
18
|
#
|
19
|
-
class DocString #:nodoc:
|
20
|
-
class Builder
|
21
|
-
attr_reader :string
|
22
|
-
|
23
|
-
def initialize
|
24
|
-
@string = ''
|
25
|
-
end
|
26
|
-
|
27
|
-
def doc_string(string, line_number)
|
28
|
-
@string = string
|
29
|
-
end
|
30
|
-
|
31
|
-
def eof
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
19
|
+
class DocString < String #:nodoc:
|
35
20
|
attr_accessor :file
|
36
21
|
|
37
22
|
def self.default_arg_name
|
38
23
|
"string"
|
39
24
|
end
|
40
25
|
|
41
|
-
|
42
|
-
builder = Builder.new
|
43
|
-
lexer = Gherkin::I18nLexer.new(builder)
|
44
|
-
lexer.scan(text)
|
45
|
-
new(builder.string)
|
46
|
-
end
|
26
|
+
attr_reader :content_type
|
47
27
|
|
48
|
-
def initialize(string)
|
49
|
-
@
|
28
|
+
def initialize(string, content_type)
|
29
|
+
@content_type = content_type
|
30
|
+
super string
|
50
31
|
end
|
51
32
|
|
52
33
|
def to_step_definition_arg
|
53
|
-
|
34
|
+
self
|
54
35
|
end
|
55
36
|
|
56
37
|
def accept(visitor)
|
57
38
|
return if Cucumber.wants_to_quit
|
58
|
-
visitor.visit_doc_string(
|
39
|
+
visitor.visit_doc_string(self)
|
59
40
|
end
|
60
41
|
|
61
42
|
def arguments_replaced(arguments) #:nodoc:
|
62
|
-
string =
|
43
|
+
string = self
|
63
44
|
arguments.each do |name, value|
|
64
45
|
value ||= ''
|
65
46
|
string = string.gsub(name, value)
|
66
47
|
end
|
67
|
-
DocString.new(string)
|
48
|
+
DocString.new(string, content_type)
|
68
49
|
end
|
69
50
|
|
70
51
|
def has_text?(text)
|
71
|
-
|
52
|
+
index(text)
|
72
53
|
end
|
73
54
|
|
74
55
|
# For testing only
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'gherkin/rubify'
|
2
|
+
|
3
|
+
module Cucumber
|
4
|
+
module Ast
|
5
|
+
module MultilineArgument
|
6
|
+
|
7
|
+
class << self
|
8
|
+
include Gherkin::Rubify
|
9
|
+
|
10
|
+
def from(argument)
|
11
|
+
return unless argument
|
12
|
+
return argument if argument.respond_to?(:to_step_definition_arg)
|
13
|
+
|
14
|
+
case(rubify(argument))
|
15
|
+
when String
|
16
|
+
# TODO: this duplicates work that gherkin does. We should really pass the string to gherkin and let it parse it.
|
17
|
+
Ast::DocString.new(argument, '')
|
18
|
+
when Gherkin::Formatter::Model::DocString
|
19
|
+
Ast::DocString.new(argument.value, argument.content_type)
|
20
|
+
when Array
|
21
|
+
Ast::Table.new(argument.map{|row| row.cells})
|
22
|
+
else
|
23
|
+
raise ArgumentError, "Don't know how to convert #{argument} into a MultilineArgument"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'cucumber/ast'
|
2
2
|
require 'gherkin/rubify'
|
3
|
+
require 'cucumber/ast/multiline_argument'
|
3
4
|
|
4
5
|
module Cucumber
|
5
6
|
module Parser
|
@@ -92,17 +93,15 @@ module Cucumber
|
|
92
93
|
@step_container.add_examples(examples_fields, examples)
|
93
94
|
end
|
94
95
|
|
95
|
-
def step(
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
end
|
105
|
-
@step_container.add_step(@table_owner)
|
96
|
+
def step(gherkin_step)
|
97
|
+
step = Ast::Step.new(
|
98
|
+
gherkin_step.line,
|
99
|
+
gherkin_step.keyword,
|
100
|
+
gherkin_step.name,
|
101
|
+
Ast::MultilineArgument.from(gherkin_step.multiline_arg)
|
102
|
+
)
|
103
|
+
step.gherkin_statement(gherkin_step)
|
104
|
+
@step_container.add_step(step)
|
106
105
|
end
|
107
106
|
|
108
107
|
def eof
|
data/lib/cucumber/platform.rb
CHANGED
@@ -4,7 +4,7 @@ require 'rbconfig'
|
|
4
4
|
|
5
5
|
module Cucumber
|
6
6
|
unless defined?(Cucumber::VERSION)
|
7
|
-
VERSION = '1.0.
|
7
|
+
VERSION = '1.0.3'
|
8
8
|
BINARY = File.expand_path(File.dirname(__FILE__) + '/../../bin/cucumber')
|
9
9
|
LIBDIR = File.expand_path(File.dirname(__FILE__) + '/../../lib')
|
10
10
|
JRUBY = defined?(JRUBY_VERSION)
|
@@ -1,7 +1,9 @@
|
|
1
1
|
require 'cucumber/constantize'
|
2
|
+
require 'cucumber/ast/multiline_argument'
|
2
3
|
require 'cucumber/runtime/for_programming_languages'
|
3
4
|
|
4
5
|
module Cucumber
|
6
|
+
|
5
7
|
class Runtime
|
6
8
|
|
7
9
|
class SupportCode
|
@@ -18,15 +20,7 @@ module Cucumber
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def step(step)
|
21
|
-
|
22
|
-
when Gherkin::Formatter::Model::DocString
|
23
|
-
step.multiline_arg.value
|
24
|
-
when Array
|
25
|
-
Ast::Table.new(step.multiline_arg.map{|row| row.cells})
|
26
|
-
else
|
27
|
-
nil
|
28
|
-
end
|
29
|
-
@support_code.invoke(step.name, cucumber_multiline_arg)
|
23
|
+
@support_code.invoke(step.name, Ast::MultilineArgument.from(step.multiline_arg))
|
30
24
|
end
|
31
25
|
|
32
26
|
def eof
|
@@ -58,6 +52,17 @@ module Cucumber
|
|
58
52
|
parser = Gherkin::Parser::Parser.new(StepInvoker.new(self), true, 'steps')
|
59
53
|
parser.parse(steps_text, file, line.to_i)
|
60
54
|
end
|
55
|
+
|
56
|
+
def invoke(step_name, multiline_argument=nil)
|
57
|
+
multiline_argument = Cucumber::Ast::MultilineArgument.from(multiline_argument)
|
58
|
+
# It is very important to leave multiline_argument=nil as a vararg. Cuke4Duke needs it that way.
|
59
|
+
begin
|
60
|
+
step_match(step_name).invoke(multiline_argument)
|
61
|
+
rescue Exception => e
|
62
|
+
e.nested! if Undefined === e
|
63
|
+
raise e
|
64
|
+
end
|
65
|
+
end
|
61
66
|
|
62
67
|
# Loads and registers programming language implementation.
|
63
68
|
# Instances are cached, so calling with the same argument
|
@@ -132,16 +137,6 @@ module Cucumber
|
|
132
137
|
matches[0]
|
133
138
|
end
|
134
139
|
|
135
|
-
def invoke(step_name, multiline_argument=nil)
|
136
|
-
# It is very important to leave multiline_argument=nil as a vararg. Cuke4Duke needs it that way.
|
137
|
-
begin
|
138
|
-
step_match(step_name).invoke(multiline_argument)
|
139
|
-
rescue Exception => e
|
140
|
-
e.nested! if Undefined === e
|
141
|
-
raise e
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
140
|
private
|
146
141
|
|
147
142
|
def guess_step_matches?
|
data/lib/cucumber/step_match.rb
CHANGED
@@ -7,7 +7,7 @@ module Cucumber
|
|
7
7
|
describe "replacing arguments" do
|
8
8
|
|
9
9
|
before(:each) do
|
10
|
-
@ps = DocString.new("<book>\n<qty>\n")
|
10
|
+
@ps = DocString.new("<book>\n<qty>\n", '')
|
11
11
|
end
|
12
12
|
|
13
13
|
it "should return a new doc_string with arguments replaced with values" do
|
@@ -23,7 +23,7 @@ module Cucumber
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should replaced nil with empty string" do
|
26
|
-
ps = DocString.new("'<book>'")
|
26
|
+
ps = DocString.new("'<book>'", '')
|
27
27
|
doc_string_with_replaced_arg = ps.arguments_replaced({'<book>' => nil})
|
28
28
|
|
29
29
|
doc_string_with_replaced_arg.to_step_definition_arg.should == "''"
|
@@ -24,7 +24,7 @@ module Cucumber
|
|
24
24
|
%w{1 22 333},
|
25
25
|
%w{4444 55555 666666}
|
26
26
|
])
|
27
|
-
doc_string = Ast::DocString.new(%{\n I like\nCucumber sandwich\n})
|
27
|
+
doc_string = Ast::DocString.new(%{\n I like\nCucumber sandwich\n}, '')
|
28
28
|
|
29
29
|
background = Ast::Background.new(Ast::Comment.new(""), 2, "Background:", "", "",
|
30
30
|
[
|
@@ -48,7 +48,7 @@ module Cucumber
|
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should replace arguments in py string arg" do
|
51
|
-
doc_string = DocString.new('taste_<taste> color_<color>')
|
51
|
+
doc_string = DocString.new('taste_<taste> color_<color>', '')
|
52
52
|
|
53
53
|
step = Step.new(1, 'Given', 'a <color> cucumber', doc_string)
|
54
54
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0.
|
5
|
+
version: 1.0.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- "Aslak Helles\xC3\xB8y"
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-07
|
13
|
+
date: 2011-09-07 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: gherkin
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 2.4.
|
23
|
+
version: 2.4.18
|
24
24
|
type: :runtime
|
25
25
|
version_requirements: *id001
|
26
26
|
- !ruby/object:Gem::Dependency
|
@@ -31,7 +31,7 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 1.0.
|
34
|
+
version: 1.0.6
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id002
|
37
37
|
- !ruby/object:Gem::Dependency
|
@@ -75,7 +75,7 @@ dependencies:
|
|
75
75
|
requirements:
|
76
76
|
- - ~>
|
77
77
|
- !ruby/object:Gem::Version
|
78
|
-
version: 0.4.
|
78
|
+
version: 0.4.6
|
79
79
|
type: :development
|
80
80
|
version_requirements: *id006
|
81
81
|
- !ruby/object:Gem::Dependency
|
@@ -108,7 +108,7 @@ dependencies:
|
|
108
108
|
requirements:
|
109
109
|
- - ">="
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: 1.
|
111
|
+
version: 1.5.0
|
112
112
|
type: :development
|
113
113
|
version_requirements: *id009
|
114
114
|
- !ruby/object:Gem::Dependency
|
@@ -152,7 +152,7 @@ dependencies:
|
|
152
152
|
requirements:
|
153
153
|
- - ">="
|
154
154
|
- !ruby/object:Gem::Version
|
155
|
-
version: 0.9.0.
|
155
|
+
version: 0.9.0.rc9
|
156
156
|
type: :development
|
157
157
|
version_requirements: *id013
|
158
158
|
- !ruby/object:Gem::Dependency
|
@@ -174,7 +174,7 @@ dependencies:
|
|
174
174
|
requirements:
|
175
175
|
- - "="
|
176
176
|
- !ruby/object:Gem::Version
|
177
|
-
version: 0.7.
|
177
|
+
version: 0.7.2
|
178
178
|
type: :development
|
179
179
|
version_requirements: *id015
|
180
180
|
- !ruby/object:Gem::Dependency
|
@@ -251,7 +251,7 @@ dependencies:
|
|
251
251
|
requirements:
|
252
252
|
- - ">="
|
253
253
|
- !ruby/object:Gem::Version
|
254
|
-
version: 1.
|
254
|
+
version: 1.1.0
|
255
255
|
type: :development
|
256
256
|
version_requirements: *id022
|
257
257
|
description: Behaviour Driven Development with elegance and joy
|
@@ -269,7 +269,6 @@ files:
|
|
269
269
|
- .rspec
|
270
270
|
- .rvmrc
|
271
271
|
- .travis.yml
|
272
|
-
- .yardopts
|
273
272
|
- Gemfile
|
274
273
|
- Gemfile.lock
|
275
274
|
- History.md
|
@@ -529,6 +528,7 @@ files:
|
|
529
528
|
- features/background.feature
|
530
529
|
- features/bootstrap.feature
|
531
530
|
- features/custom_formatter.feature
|
531
|
+
- features/doc_strings.feature
|
532
532
|
- features/execute_with_tag_filter.feature
|
533
533
|
- features/hooks.feature
|
534
534
|
- features/iso-8859-1.feature
|
@@ -538,6 +538,7 @@ files:
|
|
538
538
|
- features/step_definitions/cucumber_steps.rb
|
539
539
|
- features/step_definitions/iso-8859-1_steps.rb
|
540
540
|
- features/support/env.rb
|
541
|
+
- features/support/feature_factory.rb
|
541
542
|
- features/tagged_hooks.feature
|
542
543
|
- features/transforms.feature
|
543
544
|
- fixtures/json/features/background.feature
|
@@ -695,6 +696,7 @@ files:
|
|
695
696
|
- lib/cucumber/ast/feature.rb
|
696
697
|
- lib/cucumber/ast/feature_element.rb
|
697
698
|
- lib/cucumber/ast/features.rb
|
699
|
+
- lib/cucumber/ast/multiline_argument.rb
|
698
700
|
- lib/cucumber/ast/names.rb
|
699
701
|
- lib/cucumber/ast/outline_table.rb
|
700
702
|
- lib/cucumber/ast/scenario.rb
|
@@ -831,7 +833,7 @@ licenses: []
|
|
831
833
|
|
832
834
|
post_install_message: "\n\
|
833
835
|
(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n\n\
|
834
|
-
Thank you for installing cucumber-1.0.
|
836
|
+
Thank you for installing cucumber-1.0.3.\n\
|
835
837
|
Please be sure to read http://wiki.github.com/cucumber/cucumber/upgrading\n\
|
836
838
|
for important information about this release. Happy cuking!\n\n\
|
837
839
|
(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n\n"
|
@@ -854,14 +856,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
854
856
|
requirements: []
|
855
857
|
|
856
858
|
rubyforge_project:
|
857
|
-
rubygems_version: 1.8.
|
859
|
+
rubygems_version: 1.8.8
|
858
860
|
signing_key:
|
859
861
|
specification_version: 3
|
860
|
-
summary: cucumber-1.0.
|
862
|
+
summary: cucumber-1.0.3
|
861
863
|
test_files:
|
862
864
|
- features/background.feature
|
863
865
|
- features/bootstrap.feature
|
864
866
|
- features/custom_formatter.feature
|
867
|
+
- features/doc_strings.feature
|
865
868
|
- features/execute_with_tag_filter.feature
|
866
869
|
- features/hooks.feature
|
867
870
|
- features/iso-8859-1.feature
|
@@ -871,6 +874,7 @@ test_files:
|
|
871
874
|
- features/step_definitions/cucumber_steps.rb
|
872
875
|
- features/step_definitions/iso-8859-1_steps.rb
|
873
876
|
- features/support/env.rb
|
877
|
+
- features/support/feature_factory.rb
|
874
878
|
- features/tagged_hooks.feature
|
875
879
|
- features/transforms.feature
|
876
880
|
- spec/cucumber/ast/background_spec.rb
|
data/.yardopts
DELETED
File without changes
|