spec/bogus/mocking_dsl_spec.rb in bogus-0.0.3.rc.1 vs spec/bogus/mocking_dsl_spec.rb in bogus-0.0.3.rc.2
- old
+ new
@@ -16,11 +16,11 @@
class Stubber
extend Bogus::MockingDSL
end
before do
- Bogus.send(:clear_expectations)
+ Bogus.reset!
end
describe "#stub" do
let(:baz) { ExampleFoo.new }
@@ -161,9 +161,31 @@
expect {
Bogus.after_each_test
}.not_to raise_error(Bogus::NotAllExpectationsSatisfied)
end
+ end
+
+ class ExampleForMockingOnConstants
+ def self.bar(foo)
+ end
+
+ def self.baz
+ end
+ end
+
+ it "clears expected interactions from constants" do
+ Mocker.mock(ExampleForMockingOnConstants).bar("foo")
+
+ expect {
+ Bogus.after_each_test
+ }.to raise_error(Bogus::NotAllExpectationsSatisfied)
+
+ Mocker.stub(ExampleForMockingOnConstants).baz
+
+ expect {
+ Bogus.after_each_test
+ }.not_to raise_error(Bogus::NotAllExpectationsSatisfied)
end
context "with fakes" do
it_behaves_like "mocking dsl" do
let(:baz) { fake }