aslakhellesoy-cucumber 0.3.102.1 → 0.3.102.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -10,6 +10,9 @@ Using this release on a Rails project requires a rerun of script/generate cucumb
10
10
  * Added back a way to globally turn off transactions.
11
11
  * Renamed @allow_rescue tag to @allow-rescue.
12
12
 
13
+ === Bugfixes
14
+ * Gracefully handle cases when optional regexp groups are not matched. Ex: /should( not)? be flashed '([^']*?)'$/ (Aslak Hellesøy)
15
+
13
16
  == 2009-09-22
14
17
 
15
18
  This release has some changes in the Rails support, so make sure you run "script/generate cucumber" after you upgrade.
@@ -11,8 +11,8 @@ h2. Running the scenarios
11
11
 
12
12
  Open a shell in this directory (java) and execute the following command:
13
13
 
14
- <pre><code>
15
- ant
16
- </code></pre>
14
+ <pre>ant</pre>
17
15
 
18
16
  There is a deliberate error. See if you can fix it!
17
+
18
+ Also see "Cuke4Duke":http://wiki.github.com/aslakhellesoy/cuke4duke for more powerful JVM and Java support for Cucumber.
@@ -9,7 +9,8 @@ module Cucumber
9
9
  n = 0
10
10
  match.captures.map do |val|
11
11
  n += 1
12
- StepArgument.new(val, match.offset(n)[0])
12
+ start = match.offset(n)[0]
13
+ StepArgument.new(val, start)
13
14
  end
14
15
  else
15
16
  nil
@@ -55,6 +55,7 @@ module Cucumber
55
55
  s = string.dup
56
56
  offset = 0
57
57
  step_arguments.each do |step_argument|
58
+ next if step_argument.pos.nil?
58
59
  replacement = if block_given?
59
60
  proc.call(step_argument.val)
60
61
  elsif Proc === format
@@ -3,7 +3,7 @@ module Cucumber #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
5
  TINY = 102
6
- PATCH = 1 # Set to nil for official release
6
+ PATCH = 2 # Set to nil for official release
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
9
9
  end
@@ -8,6 +8,11 @@ module Cucumber
8
8
  arguments = RegexpArgumentMatcher.arguments_from(/I (\w+) (\w+)/, "I like fish")
9
9
  arguments.map{|argument| [argument.val, argument.pos]}.should == [["like", 2], ["fish", 7]]
10
10
  end
11
+
12
+ it "should create 2 arguments when first group is optional" do
13
+ arguments = RegexpArgumentMatcher.arguments_from(/should( not)? be flashed '([^']*?)'$/, "I should be flashed 'Login failed.'")
14
+ arguments.map{|argument| [argument.val, argument.pos]}.should == [[nil, nil], ["Login failed.", 21]]
15
+ end
11
16
  end
12
17
  end
13
18
  end
@@ -31,5 +31,10 @@ module Cucumber
31
31
  m = stepdef(/I (\w+) (\d+) (\w+) this (\w+)/).step_match("I ate 1 egg this morning", nil)
32
32
  m.format_args(lambda{|m| "<span>#{m}</span>"}).should == "I <span>ate</span> <span>1</span> <span>egg</span> this <span>morning</span>"
33
33
  end
34
+
35
+ it "should format groups even when first group is optional and not matched" do
36
+ m = stepdef(/should( not)? be flashed '([^']*?)'$/).step_match("I should be flashed 'Login failed.'", nil)
37
+ m.format_args("<span>%s</span>").should == "I should be flashed '<span>Login failed.</span>'"
38
+ end
34
39
  end
35
40
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aslakhellesoy-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.102.1
4
+ version: 0.3.102.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Aslak Helles\xC3\xB8y"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-23 00:00:00 -07:00
12
+ date: 2009-09-24 00:00:00 -07:00
13
13
  default_executable: cucumber
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency