Sha256: 4ae3efcf3229b0848006da6d6b5a63dda0e56cea9000924860210e17ce7a206b

Contents?: true

Size: 643 Bytes

Versions: 10

Compression:

Stored size: 643 Bytes

Contents

require 'spec_helper'
require 'cucumber/step_argument'

module Cucumber
  describe StepArgument do
    it "creates 2 arguments" do
      arguments = StepArgument.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 = StepArgument.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

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
cucumber-2.99.0 spec/cucumber/step_argument_spec.rb
mobiusloop-0.1.5 spec/cucumber/step_argument_spec.rb
cucumber-2.4.0 spec/cucumber/step_argument_spec.rb
mobiusloop-0.1.3 spec/cucumber/step_argument_spec.rb
mobiusloop-0.1.2 spec/cucumber/step_argument_spec.rb
cucumber-2.3.3 spec/cucumber/step_argument_spec.rb
cucumber-2.3.2 spec/cucumber/step_argument_spec.rb
cucumber-2.3.1 spec/cucumber/step_argument_spec.rb
cucumber-2.3.0 spec/cucumber/step_argument_spec.rb
cucumber-2.2.0 spec/cucumber/step_argument_spec.rb