Sha256: a6efd00b827c2e64b0b769293264173fbe16f0e68eaf8f300fcb3daa5fe1758f

Contents?: true

Size: 816 Bytes

Versions: 1

Compression:

Stored size: 816 Bytes

Contents

require 'spec_helper'

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

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

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

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

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

  it "does not record the interaction if object is not a fake" do
    stub(fake_registry).name(object) { nil }
    dont_allow(doubled_interactions).record

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bogus-0.1.5 spec/bogus/contracts/records_double_interactions_spec.rb