Sha256: f0bc05c6f32de7a6e3d167ee9b93d9ce4a754736f0ca0781e1a6faf506e5eb3f
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
require 'spec_helper' describe Bogus::AddsRecording do module SampleModule class Library end class OtherClass end end let(:create_proxy_class) { double } let(:overwrites_classes) { double } let(:overwritten_classes) { double } let(:adds_recording) { isolate(Bogus::AddsRecording) } before do allow(create_proxy_class).to receive(:call) { Object } allow(overwrites_classes).to receive(:overwrite) allow(overwritten_classes).to receive(:add) end before do adds_recording.add(:library, SampleModule::Library) end it "creates the proxy" do expect(create_proxy_class).to have_received(:call).with(:library, SampleModule::Library) end it "swaps the classes" do expect(overwrites_classes).to have_received(:overwrite).with('SampleModule::Library', Object) end it "records the overwritten class, so that it can be later restored" do expect(overwritten_classes).to have_received(:add).with("SampleModule::Library", SampleModule::Library) end it "returns the proxy class" do expect(adds_recording.add(:library, SampleModule::Library)).to eq Object end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bogus-0.1.7 | spec/bogus/contracts/adds_recording_spec.rb |
bogus-0.1.6 | spec/bogus/contracts/adds_recording_spec.rb |