cucumber 0.7.0.beta.2 → 0.7.0.beta.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,13 @@
1
+ == 0.7.0.beta.3 (2010-04-23)
2
+
3
+ === Changed Features
4
+ * Step Definitions and calling steps from step definitions can again use And and But (was removed in 0.7.0.beta.2) (Aslak Hellesøy)
5
+
6
+ == 0.7.0.beta.2 (2010-04-21)
7
+
8
+ === New Features
9
+ * Depend on Gherkin 1.0.18, which has some bugfixes. (Aslak Hellesøy)
10
+
1
11
  == 0.7.0.beta.1 (2010-04-20)
2
12
 
3
13
  Treetop is gone and replaced with Ragel. The new Ragel parser lives in the gherkin gem.
data/Rakefile CHANGED
@@ -16,7 +16,7 @@ begin
16
16
  gem.homepage = "http://cukes.info"
17
17
  gem.authors = ["Aslak Hellesøy"]
18
18
 
19
- gem.add_dependency 'gherkin', '= 1.0.18'
19
+ gem.add_dependency 'gherkin', '= 1.0.20'
20
20
  gem.add_dependency 'term-ansicolor', '>= 1.0.4'
21
21
  gem.add_dependency 'builder', '>= 2.1.2'
22
22
  gem.add_dependency 'diff-lcs', '>= 1.1.2'
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :patch: 0
3
- :build: beta.2
3
+ :build: beta.3
4
4
  :major: 0
5
5
  :minor: 7
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cucumber}
8
- s.version = "0.7.0.beta.2"
8
+ s.version = "0.7.0.beta.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Aslak Helles\303\270y"]
12
- s.date = %q{2010-04-21}
12
+ s.date = %q{2010-04-23}
13
13
  s.default_executable = %q{cucumber}
14
14
  s.description = %q{A BDD tool written in Ruby}
15
15
  s.email = %q{cukes@googlegroups.com}
@@ -537,7 +537,7 @@ Gem::Specification.new do |s|
537
537
 
538
538
  (::) U P G R A D I N G (::)
539
539
 
540
- Thank you for installing cucumber-0.7.0.beta.2.
540
+ Thank you for installing cucumber-0.7.0.beta.3.
541
541
  Please be sure to read http://wiki.github.com/aslakhellesoy/cucumber/upgrading
542
542
  for important information about this release. Happy cuking!
543
543
 
@@ -714,7 +714,7 @@ for important information about this release. Happy cuking!
714
714
  s.specification_version = 3
715
715
 
716
716
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
717
- s.add_runtime_dependency(%q<gherkin>, ["= 1.0.18"])
717
+ s.add_runtime_dependency(%q<gherkin>, ["= 1.0.20"])
718
718
  s.add_runtime_dependency(%q<term-ansicolor>, [">= 1.0.4"])
719
719
  s.add_runtime_dependency(%q<builder>, [">= 2.1.2"])
720
720
  s.add_runtime_dependency(%q<diff-lcs>, [">= 1.1.2"])
@@ -727,7 +727,7 @@ for important information about this release. Happy cuking!
727
727
  s.add_development_dependency(%q<syntax>, [">= 1.0.0"])
728
728
  s.add_development_dependency(%q<spork>, [">= 0.7.5"])
729
729
  else
730
- s.add_dependency(%q<gherkin>, ["= 1.0.18"])
730
+ s.add_dependency(%q<gherkin>, ["= 1.0.20"])
731
731
  s.add_dependency(%q<term-ansicolor>, [">= 1.0.4"])
732
732
  s.add_dependency(%q<builder>, [">= 2.1.2"])
733
733
  s.add_dependency(%q<diff-lcs>, [">= 1.1.2"])
@@ -741,7 +741,7 @@ for important information about this release. Happy cuking!
741
741
  s.add_dependency(%q<spork>, [">= 0.7.5"])
742
742
  end
743
743
  else
744
- s.add_dependency(%q<gherkin>, ["= 1.0.18"])
744
+ s.add_dependency(%q<gherkin>, ["= 1.0.20"])
745
745
  s.add_dependency(%q<term-ansicolor>, [">= 1.0.4"])
746
746
  s.add_dependency(%q<builder>, [">= 2.1.2"])
747
747
  s.add_dependency(%q<diff-lcs>, [">= 1.1.2"])
@@ -24,7 +24,7 @@ Feature: http://gist.github.com/221223
24
24
  """
25
25
  And a file named "features/step_definitions/steps.rb" with:
26
26
  """
27
- Given /^a multiline string:$/ do |s| x=1
27
+ And /^a multiline string:$/ do |s| x=1
28
28
  raise "I got multiline:\n#{s}"
29
29
  end
30
30
 
@@ -34,7 +34,7 @@ Feature: http://gist.github.com/221223
34
34
 
35
35
  Given /^I call a multiline string with (.*)$/ do |s| x=1
36
36
  steps %Q{
37
- Given a multiline string:
37
+ And a multiline string:
38
38
  \"\"\"
39
39
  hello
40
40
  #{s}
@@ -20,6 +20,8 @@ Feature: Language help
20
20
  | given (code) | "Dado" |
21
21
  | when (code) | "Quando" |
22
22
  | then (code) | "Então", "Entao" |
23
+ | and (code) | "E" |
24
+ | but (code) | "Mas" |
23
25
 
24
26
  """
25
27
  Scenario: List languages
@@ -49,13 +49,13 @@ module Cucumber
49
49
  @string = string
50
50
  end
51
51
 
52
- def to_s
52
+ def to_step_definition_arg
53
53
  @string
54
54
  end
55
55
 
56
56
  def accept(visitor)
57
57
  return if Cucumber.wants_to_quit
58
- visitor.visit_py_string(to_s)
58
+ visitor.visit_py_string(@string)
59
59
  end
60
60
 
61
61
  def arguments_replaced(arguments) #:nodoc:
@@ -73,7 +73,7 @@ module Cucumber
73
73
 
74
74
  # For testing only
75
75
  def to_sexp #:nodoc:
76
- [:py_string, to_s]
76
+ [:py_string, to_step_definition_arg]
77
77
  end
78
78
  end
79
79
  end
@@ -80,6 +80,10 @@ module Cucumber
80
80
  @conversion_procs = conversion_procs
81
81
  end
82
82
 
83
+ def to_step_definition_arg
84
+ dup
85
+ end
86
+
83
87
  # Creates a copy of this table, inheriting any column mappings.
84
88
  # registered with #map_headers!
85
89
  #
@@ -161,6 +161,9 @@ module Cucumber
161
161
  "several times, and this represents logical AND. Example: --tags @foo,~@bar --tags @zap.",
162
162
  "This represents the boolean expression (@foo || !@bar) && @zap.",
163
163
  "\n",
164
+ "Beware that if you want to use several negative tags to exclude several tags",
165
+ "you have to use logical AND: --tags ~@fixme --tags @buggy.",
166
+ "\n",
164
167
  "Positive tags can be given a threshold to limit the number of occurrences.",
165
168
  "Example: --tags @qa:3 will fail if there are more than 3 occurrences of the @qa tag.",
166
169
  "This can be practical if you are practicing Kanban or CONWIP.") do |v|
@@ -49,7 +49,6 @@ module Cucumber
49
49
  end
50
50
 
51
51
  def invoke(args)
52
- args = args.map{|arg| Ast::PyString === arg ? arg.to_s : arg}
53
52
  begin
54
53
  args = @rb_language.execute_transforms(args)
55
54
  @rb_language.current_world.cucumber_instance_exec(true, regexp_source, *args, &@proc)
@@ -20,7 +20,7 @@ module Cucumber
20
20
 
21
21
  def invoke(multiline_arg)
22
22
  all_args = args
23
- all_args << multiline_arg.dup if multiline_arg
23
+ all_args << multiline_arg.to_step_definition_arg if multiline_arg
24
24
  @step_definition.invoke(all_args)
25
25
  end
26
26
 
@@ -188,23 +188,44 @@ module Cucumber
188
188
  # Given I have 8 cukes in my belly
189
189
  # Then I should not be thirsty
190
190
  # })
191
- def invoke_steps(steps_text, natural_language)
192
- ored_keywords = natural_language.step_keywords.map{|kw| Regexp.escape(kw)}.join("|")
193
- # TODO Gherkin:
194
- # This a bit hacky and fragile. When we move to Gherkin we should replace this entire method body
195
- # with a call to the parser - parsing the body of a scenario. We may need to put the parser/policy in the
196
- # appropriate state (the same state it's in after parsing a Scenario: line).
197
- steps_text.strip.split(/(?=^\s*(?:#{ored_keywords}))/).map { |step| step.strip }.each do |step|
198
- output = step.match(/^\s*(#{ored_keywords})([^\n]+)(\n.*)?$/m)
199
-
200
- action, step_name, table_or_string = output[1], output[2], output[3]
201
- if table_or_string.to_s.strip =~ /^\|/
202
- table_or_string = table(table_or_string)
203
- elsif table_or_string.to_s.strip =~ /^"""/
204
- table_or_string = py_string(table_or_string.gsub(/^\n/, ""))
191
+ def invoke_steps(steps_text, i18n)
192
+ lexer = i18n.lexer(Gherkin::Parser::Parser.new(StepInvoker.new(self), true, 'steps'))
193
+ lexer.scan(steps_text)
194
+ end
195
+
196
+ class StepInvoker
197
+ def initialize(step_mother)
198
+ @step_mother = step_mother
199
+ end
200
+
201
+ def step(keyword, name, line)
202
+ invoke
203
+ @name = name
204
+ end
205
+
206
+ def py_string(string, line)
207
+ @multiline = Ast::PyString.new(string)
208
+ end
209
+
210
+ def row(row, line)
211
+ @rows ||= []
212
+ @rows << row
213
+ end
214
+
215
+ def eof
216
+ invoke
217
+ end
218
+
219
+ private
220
+
221
+ def invoke
222
+ if @name
223
+ @multiline = Ast::Table.new(@rows) if @multiline.nil? && @rows
224
+ @step_mother.invoke(*[@name, @multiline].compact)
225
+ @name = nil
226
+ @multiline = nil
227
+ @rows = nil
205
228
  end
206
- args = [step_name, table_or_string].compact
207
- invoke(*args)
208
229
  end
209
230
  end
210
231
 
@@ -13,7 +13,7 @@ module Cucumber
13
13
  it "should return a new py_string with arguments replaced with values" do
14
14
  py_string_with_replaced_arg = @ps.arguments_replaced({'<book>' => 'Life is elsewhere', '<qty>' => '5'})
15
15
 
16
- py_string_with_replaced_arg.to_s.should == "Life is elsewhere\n5\n"
16
+ py_string_with_replaced_arg.to_step_definition_arg.should == "Life is elsewhere\n5\n"
17
17
  end
18
18
 
19
19
  it "should not change the original py_string" do
@@ -26,7 +26,7 @@ module Cucumber
26
26
  ps = PyString.new("'<book>'")
27
27
  py_string_with_replaced_arg = ps.arguments_replaced({'<book>' => nil})
28
28
 
29
- py_string_with_replaced_arg.to_s.should == "''"
29
+ py_string_with_replaced_arg.to_step_definition_arg.should == "''"
30
30
  end
31
31
 
32
32
  it "should recognise when just a subset of a cell is delimited" do
@@ -59,7 +59,7 @@ module Cucumber
59
59
  cells = invocation_table.cells_rows[1]
60
60
  step_invocation = step.step_invocation_from_cells(cells)
61
61
 
62
- step_invocation.instance_variable_get('@multiline_arg').to_s.should == 'taste_juicy color_green'
62
+ step_invocation.instance_variable_get('@multiline_arg').to_step_definition_arg.should == 'taste_juicy color_green'
63
63
  end
64
64
  end
65
65
  end
metadata CHANGED
@@ -7,8 +7,8 @@ version: !ruby/object:Gem::Version
7
7
  - 7
8
8
  - 0
9
9
  - beta
10
- - 2
11
- version: 0.7.0.beta.2
10
+ - 3
11
+ version: 0.7.0.beta.3
12
12
  platform: ruby
13
13
  authors:
14
14
  - "Aslak Helles\xC3\xB8y"
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-04-21 00:00:00 +02:00
19
+ date: 2010-04-23 00:00:00 +02:00
20
20
  default_executable: cucumber
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -29,8 +29,8 @@ dependencies:
29
29
  segments:
30
30
  - 1
31
31
  - 0
32
- - 18
33
- version: 1.0.18
32
+ - 20
33
+ version: 1.0.20
34
34
  type: :runtime
35
35
  version_requirements: *id001
36
36
  - !ruby/object:Gem::Dependency
@@ -718,7 +718,7 @@ post_install_message: |+
718
718
 
719
719
  (::) U P G R A D I N G (::)
720
720
 
721
- Thank you for installing cucumber-0.7.0.beta.2.
721
+ Thank you for installing cucumber-0.7.0.beta.3.
722
722
  Please be sure to read http://wiki.github.com/aslakhellesoy/cucumber/upgrading
723
723
  for important information about this release. Happy cuking!
724
724