Sha256: aefa90c36767ecfe9cb484ef386f47793a3354ef5c04ba1fe13b1855af1b66c2

Contents?: true

Size: 748 Bytes

Versions: 13

Compression:

Stored size: 748 Bytes

Contents

require '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

13 entries across 13 versions & 3 rubygems

Version Path
casecumber-1.0.2.1 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-1.1.2 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-1.1.1 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
js-log-cucumber-1.0.2 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-1.1.0 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-1.0.6 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-1.0.5 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-1.0.4 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-1.0.3 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-1.0.2 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-1.0.1 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-1.0.0 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.8.6 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb