Sha256: d1b25b8fa358fcbb51f3806e2222651c3d3519c1a0a5008c17f17261afec1591

Contents?: true

Size: 798 Bytes

Versions: 38

Compression:

Stored size: 798 Bytes

Contents

require File.expand_path(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

38 entries across 38 versions & 3 rubygems

Version Path
cucumber-0.8.7 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.10.7 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.10.6 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.10.5 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.10.3 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.10.2 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.10.1 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
stefl-cucumber-0.10.1 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
vim-jar-0.1.2.0001 bundler/ruby/1.8/gems/cucumber-0.9.4/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
vim-jar-0.1.2 bundler/ruby/1.8/gems/cucumber-0.9.4/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
vim-jar-0.1.1 bundler/ruby/1.8/gems/cucumber-0.9.4/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
vim-jar-0.1.0 bundler/ruby/1.8/gems/cucumber-0.9.4/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.10.0 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.9.4 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.9.3 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.9.2 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.9.1 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.9.0 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.8.5 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-0.8.4 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb