Sha256: a780ec183070652fa01aee0aac9214b00772eae6ad49da4218852b8ef06a548e

Contents?: true

Size: 680 Bytes

Versions: 1

Compression:

Stored size: 680 Bytes

Contents

require 'object_protocol/satisfiable_unordered_message_sequence_expectation'

class ObjectProtocol
  class UnorderedMessageSequenceExpectation
    def initialize(protocol:)
      @protocol = protocol
    end

    def expectations
      @expectations ||= []
    end

    def to_rspec_matcher_failure_message_lines
      [
        "in_any_order",
        *expectations.flat_map(&:to_rspec_matcher_failure_message_lines).map(&"  ".method(:+)),
      ]
    end

    def to_satisfiable
      SatisfiableUnorderedMessageSequenceExpectation.new(
        protocol:             protocol,
        sequence_expectation: self
      )
    end

    private

    attr_reader :protocol
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
object_protocol-0.2.0 lib/object_protocol/unordered_message_sequence_expectation.rb