Sha256: e1c05162c91315d8578574b44bfddff49977f887bb4fb81647301045615837f9
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
require "spec_helper" class Example def foo; end end describe Example do context "configured to use verifying doubles" do before(:all) { RSpec::Mocks.configuration.verify_partial_doubles = true } describe "temporarily using normal doubles", :normal_doubles do it "does not raise an error when a non-existent method is stubbed" do expect{allow(subject).to receive(:fo)}.to_not raise_error end end it "raises an error when a non-existent method is stubbed" do expect{allow(subject).to receive(:fo)}.to raise_error(RSpec::Mocks::MockExpectationError) end end context "configured to use normal doubles" do before(:all) { RSpec::Mocks.configuration.verify_partial_doubles = false } describe "temporarily using verifying doubles", :verifying_doubles do it "raises an error if a non-existent method is stubbed" do expect{allow(subject).to receive(:fo)}.to raise_error(RSpec::Mocks::MockExpectationError) end end it "does not raise an error when a non-existent method is stubbed" do expect{allow(subject).to receive(:fo)}.to_not raise_error end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rspec-context-doubles-0.0.1 | spec/lib/rspec/context/doubles/doubles_spec.rb |