Sha256: 396537c22774226dfe17778f5016e3c6f8abd4612ad8ca7e598477fb66ed9382

Contents?: true

Size: 921 Bytes

Versions: 2

Compression:

Stored size: 921 Bytes

Contents

require 'spec_helper'

describe Bogus::Double do
  let(:rr_double) { stub }
  let(:verifies_stub_definition) { stub }
  let(:records_double_interactions) { stub }

  let(:object) { "strings have plenty of methods to call" }

  let(:bogus_double) { isolate(Bogus::Double, double: rr_double) }

  before do
    stub(verifies_stub_definition).verify!
    stub(records_double_interactions).record
    stub(rr_double).method_name

    bogus_double.method_name(:foo, :bar)
  end

  it "verifies that stub definition matches the real definition" do
    verifies_stub_definition.should have_received.verify!(object, :method_name, [:foo, :bar])
  end

  it "records the stub interaction so that it can be verified later" do
    records_double_interactions.should have_received.record(object, :method_name, [:foo, :bar])
  end

  it "proxies the method call" do
    rr_double.should have_received.method_name(:foo, :bar)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bogus-0.0.2 spec/bogus/double_spec.rb
bogus-0.0.1 spec/bogus/double_spec.rb