Skip to content

Commit

Permalink
regexp_argument_matcher_spec.rb:20 is pending under jruby.
Browse files Browse the repository at this point in the history
  • Loading branch information
akiellor committed Apr 24, 2012
1 parent 3a21337 commit 00392c5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
8 changes: 6 additions & 2 deletions spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
module Cucumber
module RbSupport
describe RegexpArgumentMatcher do
include RSpec::WorkInProgress

it "should create 2 arguments" do
arguments = RegexpArgumentMatcher.arguments_from(/I (\w+) (\w+)/, "I like fish")
arguments.map{|argument| [argument.val, argument.offset]}.should == [["like", 2], ["fish", 7]]
end

it "should create 2 arguments when first group is optional" do
arguments = RegexpArgumentMatcher.arguments_from(/should( not)? be flashed '([^']*?)'$/, "I should be flashed 'Login failed.'")
arguments.map{|argument| [argument.val, argument.offset]}.should == [[nil, nil], ["Login failed.", 21]]
pending_under :java, "requires cucumber/gherkin >= ac42f51" do
arguments = RegexpArgumentMatcher.arguments_from(/should( not)? be flashed '([^']*?)'$/, "I should be flashed 'Login failed.'")
arguments.map{|argument| [argument.val, argument.offset]}.should == [[nil, nil], ["Login failed.", 21]]
end
end
end
end
Expand Down
8 changes: 6 additions & 2 deletions spec/cucumber/step_match_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

module Cucumber
describe StepMatch do
include RSpec::WorkInProgress

WORD = Cucumber::RUBY_1_9 ? '[[:word:]]' : '\w'

before do
Expand Down Expand Up @@ -57,8 +59,10 @@ def step_match(regexp, name)
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
Expand Down
14 changes: 14 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,17 @@
::Cucumber::Term::ANSIColor.coloring = true
end
end

module RSpec
module WorkInProgress
def pending_under platforms, reason, &block
if [platforms].flatten.map(&:to_s).include? RUBY_PLATFORM
pending "pending under #{platforms.inspect} because: #{reason}", &block
else
yield
end
end
end
end


0 comments on commit 00392c5

Please sign in to comment.