spec/cucumber/step_match_spec.rb in cucumber-1.1.9 vs spec/cucumber/step_match_spec.rb in cucumber-1.2.0
- old
+ new
@@ -3,18 +3,20 @@
require 'cucumber/rb_support/rb_step_definition'
require 'cucumber/rb_support/rb_language'
module Cucumber
describe StepMatch do
+ include RSpec::WorkInProgress
+
WORD = Cucumber::RUBY_1_9 ? '[[:word:]]' : '\w'
before do
@rb_language = RbSupport::RbLanguage.new(nil)
end
def stepdef(regexp)
- RbSupport::RbStepDefinition.new(@rb_language, regexp, lambda{})
+ RbSupport::RbStepDefinition.new(@rb_language, regexp, lambda{}, {})
end
def step_match(regexp, name)
stepdef = stepdef(regexp)
StepMatch.new(stepdef, name, nil, stepdef.arguments_from(name))
@@ -55,15 +57,17 @@
m = step_match(/I (#{WORD}+) (\d+) (#{WORD}+) this (#{WORD}+)/, "I ate 1 egg this morning")
m.format_args(lambda{|m| "<span>#{m}</span>"}).should == "I <span>ate</span> <span>1</span> <span>egg</span> this <span>morning</span>"
end
it "should format groups even when first group is optional and not matched" do
- m = step_match(/should( not)? be flashed '([^']*?)'$/, "I should be flashed 'Login failed.'")
- m.format_args("<span>%s</span>").should == "I should be flashed '<span>Login failed.</span>'"
+ pending_under :java, "requires cucumber/gherkin >= ac42f51" do
+ m = step_match(/should( not)? be flashed '([^']*?)'$/, "I should be flashed 'Login failed.'")
+ m.format_args("<span>%s</span>").should == "I should be flashed '<span>Login failed.</span>'"
+ end
end
it "should format embedded groups" do
m = step_match(/running( (\d+) times)? (\d+) meters/, "running 5 times 10 meters")
m.format_args("<span>%s</span>").should == "running<span> 5 times</span> <span>10</span> meters"
end
end
-end
\ No newline at end of file
+end