Skip to content
Browse files

Don't leak a class out of the spec

  • Loading branch information...
1 parent 2a39025 commit 275d585f2f99093a543d75c9e751f8826d4ea34a @rentalcustard rentalcustard committed
Showing with 3 additions and 9 deletions.
  1. +3 −9 spec/rspec/matchers/be_instance_of_spec.rb
View
12 spec/rspec/matchers/be_instance_of_spec.rb
@@ -27,16 +27,10 @@ module Matchers
end
context "when expected provides an expanded inspect, e.g. AR::Base" do
- class User
- def self.inspect
- "User(id: integer, name: string)"
- end
- end
-
+ before { Fixnum.stub(:inspect) { "foo" } }
it "provides a description including only the class name" do
- matcher = be_an_instance_of(User)
- #it will be namespaced because I defined it inside this spec file
- matcher.description.should == "be an instance of RSpec::Matchers::User"
+ matcher = be_an_instance_of(Fixnum)
+ matcher.description.should == "be an instance of Fixnum"
end
end
end

0 comments on commit 275d585

Please sign in to comment.
Something went wrong with that request. Please try again.