Sha256: 843758a331b91497531c33ed763a6310f77f1ef145d79312b92976f6f854c469

Contents?: true

Size: 773 Bytes

Versions: 14

Compression:

Stored size: 773 Bytes

Contents

require 'spec_helper'
require 'cucumber/rb_support/regexp_argument_matcher'

module Cucumber
  module RbSupport
    describe RegexpArgumentMatcher do
      include RSpec::WorkInProgress

      it "creates 2 arguments" do
        arguments = RegexpArgumentMatcher.arguments_from(/I (\w+) (\w+)/, "I like fish")

        expect(arguments.map{|argument| [argument.val, argument.offset]}).to eq [["like", 2], ["fish", 7]]
      end

      it "creates 2 arguments when first group is optional" do
        arguments = RegexpArgumentMatcher.arguments_from(/should( not)? be flashed '([^']*?)'$/, "I should be flashed 'Login failed.'")

        expect(arguments.map{|argument| [argument.val, argument.offset]}).to eq [[nil, nil], ["Login failed.", 21]]
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
cucumber-2.1.0 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-2.0.2 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-2.0.1 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-2.0.0 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-2.0.0.rc.5 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-2.0.0.rc.4 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-2.0.0.rc.3 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-2.0.0.rc.2 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-2.0.0.rc.1 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-2.0.0.beta.5 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-2.0.0.beta.4 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-2.0.0.beta.3 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-2.0.0.beta.2 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
cucumber-2.0.0.beta.1 spec/cucumber/rb_support/regexp_argument_matcher_spec.rb