Sha256: 660fe0b3661ea8a8fba3a746cf1001d5950a6b8399990c9b1fa4c4c9b957bc4a

Contents?: true

Size: 780 Bytes

Versions: 8

Compression:

Stored size: 780 Bytes

Contents

require File.dirname(__FILE__) + '/../../spec_helper'
require 'cucumber/rb_support/regexp_argument_matcher'

module Cucumber
  module RbSupport
    describe RegexpArgumentMatcher do
      it "should create 2 arguments" do
        arguments = RegexpArgumentMatcher.arguments_from(/I (\w+) (\w+)/, "I like fish")
        arguments.map{|argument| [argument.val, argument.byte_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.byte_offset]}.should == [[nil, nil], ["Login failed.", 21]]
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
davidtrogers-cucumber-0.6.2 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.6.2 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.6.1 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.6.0 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.5.3 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.5.2 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.5.1 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.5.0 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb