Skip to content

Commit

Permalink
Use stub_const rather than defining an empty module.
Browse files Browse the repository at this point in the history
The old way "leaked" in the sense that it globally added an empty
module that only a few tests need.
  • Loading branch information
myronmarston committed Sep 10, 2012
1 parent ace84f8 commit 7c537b7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions spec/rspec/core/configuration_spec.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,9 +1,6 @@
require 'spec_helper' require 'spec_helper'
require 'tmpdir' require 'tmpdir'


# so the stdlib module is available...
module Test; module Unit; module Assertions; end; end; end

module RSpec::Core module RSpec::Core


describe Configuration do describe Configuration do
Expand Down Expand Up @@ -149,7 +146,10 @@ module RSpec::Core
end end


describe "#expect_with" do 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 it_behaves_like "a configurable framework adapter", :expect_with


Expand Down Expand Up @@ -209,7 +209,10 @@ module RSpec::Core
end end


describe "#expecting_with_rspec?" do 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 it "returns false by default" do
config.should_not be_expecting_with_rspec config.should_not be_expecting_with_rspec
Expand Down

0 comments on commit 7c537b7

Please sign in to comment.