Sha256: a4cf04f95dc2ced64a505e073c52d3649d2521affe0b7dd2f94b1a1f92168d69

Contents?: true

Size: 912 Bytes

Versions: 9

Compression:

Stored size: 912 Bytes

Contents

require 'spec_helper'

describe Bogus::RegistersCreatedFakes do
  let(:fake_registry) { stub }
  let(:creates_fakes) { stub }
  let(:double_tracker) { stub }

  let(:registers_created_fakes) { isolate(Bogus::RegistersCreatedFakes) }

  before do
    stub(fake_registry).store
    stub(creates_fakes).create { :the_fake }
    stub(double_tracker).track(:the_fake)
  end

  it "registers the fakes created by creates_fakes" do
    registers_created_fakes.create(:foo, as: :instance) { Object }

    fake_registry.should have_received.store(:foo, :the_fake)
  end

  it "tracks the created fakes for purposes of mock expectations" do
    registers_created_fakes.create(:foo, as: :instance) { Object }

    double_tracker.should have_received.track(:the_fake)
  end

  it "returns the created fake" do
    fake = registers_created_fakes.create(:foo, as: :instance) { Object }

    fake.should == :the_fake
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bogus-0.1.4 spec/bogus/fakes/registers_created_fakes_spec.rb
bogus-0.1.3 spec/bogus/registers_created_fakes_spec.rb
bogus-0.1.2 spec/bogus/registers_created_fakes_spec.rb
bogus-0.1.1 spec/bogus/registers_created_fakes_spec.rb
bogus-0.1.0 spec/bogus/registers_created_fakes_spec.rb
bogus-0.0.4 spec/bogus/registers_created_fakes_spec.rb
bogus-0.0.3 spec/bogus/registers_created_fakes_spec.rb
bogus-0.0.3.rc.2 spec/bogus/registers_created_fakes_spec.rb
bogus-0.0.3.rc.1 spec/bogus/registers_created_fakes_spec.rb