Sha256: 2378f4a13528a83d257accdf2e8e2f75d164caf54f31c31b70137af23ff540a1

Contents?: true

Size: 579 Bytes

Versions: 2

Compression:

Stored size: 579 Bytes

Contents

module Bogus
  class ContractNotFulfilled < StandardError
    attr_reader :interactions

    def initialize(interactions)
      @interactions = interactions
      super(message)
    end

    def message
      interactions.map { |fake_name, missed| missed_for_fake(fake_name, missed) }.join("\n")
    end

    private

    def missed_for_fake(fake_name, missed)
      "Contract not fullfilled for #{fake_name}:\n#{missed_interactions(missed)}"
    end

    def missed_interactions(missed)
      missed.map { |i| "  - #{InteractionPresenter.new(i)}" }.join("\n")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bogus-0.0.2 lib/bogus/contract_not_fulfilled.rb
bogus-0.0.1 lib/bogus/contract_not_fulfilled.rb