Sha256: 08f6ed38f02c0cb72e89941917bb4fef1f5596895c25d472a9896f09ba7e802a

Contents?: true

Size: 951 Bytes

Versions: 2

Compression:

Stored size: 951 Bytes

Contents

require 'spec_helper'

describe Bogus::RecordsDoubleInteractions do
  let(:fake_registry) { double }
  let(:doubled_interactions) { double }
  let(:object) { Object.new }

  let(:records_double_interactions) { isolate(Bogus::RecordsDoubleInteractions) }

  it "records the call in double interaction repository" do
    allow(fake_registry).to receive(:name).with(object) { :object_name }
    allow(doubled_interactions).to receive(:record)

    records_double_interactions.record(object, :method_name, [:foo, 1])

    expect(doubled_interactions).to have_received(:record).with(:object_name, :method_name, :foo, 1)
  end

  it "does not record the interaction if object is not a fake" do
    allow(fake_registry).to receive(:name).with(object) { nil }
    allow(doubled_interactions).to receive(:record)

    records_double_interactions.record(object, :method_name, [:foo, 1])

    expect(doubled_interactions).not_to have_received(:record)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bogus-0.1.7 spec/bogus/contracts/records_double_interactions_spec.rb
bogus-0.1.6 spec/bogus/contracts/records_double_interactions_spec.rb