Sha256: 862f1eada1289dbb6e0591c7ae0aa8062f74c30a964e0474ec68aeed7711d29b

Contents?: true

Size: 461 Bytes

Versions: 12

Compression:

Stored size: 461 Bytes

Contents

RSpec::Matchers.define :include_in_order do |*expected|

  match do |actual|
    elements = expected.dup
    actual.each do |elt|
      if elt == elements.first
        elements.shift
      end
    end
    elements.empty?
  end

  def failure_message
    "expected #{@actual.inspect} to include#{expected_to_sentence} in order"
  end

  def failure_message_when_negated
    "expected #{@actual.inspect} not to include#{expected_to_sentence} in order"
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
puppet-4.2.3 spec/lib/matchers/include_in_order.rb
puppet-4.2.3-x86-mingw32 spec/lib/matchers/include_in_order.rb
puppet-4.2.3-x64-mingw32 spec/lib/matchers/include_in_order.rb
puppet-4.2.2 spec/lib/matchers/include_in_order.rb
puppet-4.2.2-x86-mingw32 spec/lib/matchers/include_in_order.rb
puppet-4.2.2-x64-mingw32 spec/lib/matchers/include_in_order.rb
puppet-4.2.1 spec/lib/matchers/include_in_order.rb
puppet-4.2.1-x86-mingw32 spec/lib/matchers/include_in_order.rb
puppet-4.2.1-x64-mingw32 spec/lib/matchers/include_in_order.rb
puppet-4.2.0 spec/lib/matchers/include_in_order.rb
puppet-4.2.0-x86-mingw32 spec/lib/matchers/include_in_order.rb
puppet-4.2.0-x64-mingw32 spec/lib/matchers/include_in_order.rb