lib/bogus/rspec_extensions.rb in bogus-0.1.0 vs lib/bogus/rspec_extensions.rb in bogus-0.1.1
- old
+ new
@@ -9,11 +9,18 @@
fake_class(name, opts)
end
end
def verify_contract(name)
+ old_described_class = described_class
+
before do
- Bogus.record_calls_for(name, described_class)
+ new_class = Bogus.record_calls_for(name, described_class)
+ example.metadata[:example_group][:described_class] = new_class
+ end
+
+ after do
+ example.metadata[:example_group][:described_class] = old_described_class
end
RSpec.configure do |config|
config.after(:suite) { Bogus.verify_contract!(name) }
end