Sha256: fa3dde0309a087818f5f36166c8eb7e84f52372c8b7c21f94ce2d77ddd9c7459

Contents?: true

Size: 764 Bytes

Versions: 20

Compression:

Stored size: 764 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.pos]}.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.pos]}.should == [[nil, nil], ["Login failed.", 21]]
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 6 rubygems

Version Path
aslakhellesoy-cucumber-0.3.102.2 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
aslakhellesoy-cucumber-0.3.103 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
aslakhellesoy-cucumber-0.3.104 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
kosmas58-cucumber-0.3.103 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.4.5.rc2 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
kbaum-cucumber-0.4.5.pre spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.4.5.rc1 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
middleman-0.10.17 vendor/gems/gems/cucumber-0.4.4/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
middleman-0.10.16 vendor/gems/gems/cucumber-0.4.4/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
middleman-0.10.15 vendor/gems/gems/cucumber-0.4.4/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
rackjour-0.1.8 vendor/gems/gems/cucumber-0.4.4/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
middleman-0.10.14 vendor/gems/gems/cucumber-0.4.4/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.4.4 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.4.3 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.4.2 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.4.1 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.4.0 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.4.0.rc1 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.3.104 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.3.103 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb