Sha256: 0eb5603b50183a84e26591ecfdfe9084e8842c833fccb6d1c9c5519e22cae6b9

Contents?: true

Size: 729 Bytes

Versions: 4

Compression:

Stored size: 729 Bytes

Contents

require_relative '../spec_helper'

module Lucid
  module InterfaceRb
    describe RegexpArgumentMatcher do

      it 'should create two arguments' do
        arguments = RegexpArgumentMatcher.arguments_from(/Lucid (\w+) (\w+)/, 'Lucid works well')
        arguments.map{|argument| [argument.val, argument.offset]}.should == [['works', 6], ['well', 12]]
      end

      it 'should create two arguments when first group is optional' do
        arguments = RegexpArgumentMatcher.arguments_from(/should( not)? be shown '([^']*?)'$/, "should be shown 'Login failed.'")
        arguments.map{|argument| [argument.val, argument.offset]}.should == [[nil, nil], ['Login failed.', 17]]
      end
      
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lucid-0.4.1 spec/lucid/regexp_argument_matcher_spec.rb
lucid-0.4.0 spec/lucid/regexp_argument_matcher_spec.rb
lucid-0.3.3 spec/lucid/regexp_argument_matcher_spec.rb
lucid-0.3.0 spec/lucid/regexp_argument_matcher_spec.rb