Permalink
Browse files

Use `stub_const` rather than defining an empty module.

The old way "leaked" in the sense that it globally added an empty
module that only a few tests need.
  • Loading branch information...
1 parent ace84f8 commit 7c537b701a148137ab1052a773b40370bbd3edac @myronmarston myronmarston committed Sep 10, 2012
Showing with 8 additions and 5 deletions.
  1. +8 −5 spec/rspec/core/configuration_spec.rb
@@ -1,9 +1,6 @@
require 'spec_helper'
require 'tmpdir'
-# so the stdlib module is available...
-module Test; module Unit; module Assertions; end; end; end
-
module RSpec::Core
describe Configuration do
@@ -149,7 +146,10 @@ module RSpec::Core
end
describe "#expect_with" do
- before { config.stub(:require) }
+ before do
+ stub_const("Test::Unit::Assertions", Module.new)
+ config.stub(:require)
+ end
it_behaves_like "a configurable framework adapter", :expect_with
@@ -209,7 +209,10 @@ module RSpec::Core
end
describe "#expecting_with_rspec?" do
- before { config.stub(:require) }
+ before do
+ stub_const("Test::Unit::Assertions", Module.new)
+ config.stub(:require)
+ end
it "returns false by default" do
config.should_not be_expecting_with_rspec

0 comments on commit 7c537b7

Please sign in to comment.