Sha256: 5f813064ff0a49804162afc61a2260c51d538a04f5713a5a9f4beb760157726f

Contents?: true

Size: 500 Bytes

Versions: 7

Compression:

Stored size: 500 Bytes

Contents

module Bogus
  class InteractionsRepository
    def initialize
      @interactions = Hash.new { |hash, fake_name| hash[fake_name] = [] }
    end

    def record(fake_name, method, *args, &block)
      @interactions[fake_name] << Interaction.new(method, args, &block)
    end

    def recorded?(fake_name, interaction)
      @interactions[fake_name].any?{ |i| Interaction.same?(stubbed: interaction, recorded: i) }
    end

    def for_fake(fake_name)
      @interactions[fake_name]
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bogus-0.1.7 lib/bogus/contracts/interactions_repository.rb
bogus-0.1.6 lib/bogus/contracts/interactions_repository.rb
bogus-0.1.5 lib/bogus/contracts/interactions_repository.rb
bogus-0.1.4 lib/bogus/contracts/interactions_repository.rb
bogus-0.1.3 lib/bogus/interactions_repository.rb
bogus-0.1.2 lib/bogus/interactions_repository.rb
bogus-0.1.1 lib/bogus/interactions_repository.rb