Skip to content

Commit

Permalink
Assign name to class doubles.
Browse files Browse the repository at this point in the history
#name is part of the standard class interface. It's a bit silly to make people stub it.
  • Loading branch information
myronmarston committed Mar 14, 2012
1 parent e385b51 commit 48d85c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/rspec/fire.rb
Expand Up @@ -159,6 +159,10 @@ def self.as_replaced_constant(options = {})
def self.to_s
@__doubled_class_name + " (fire double)"
end

def self.name
@__doubled_class_name
end
end
end

Expand Down
5 changes: 5 additions & 0 deletions spec/fire_double_spec.rb
Expand Up @@ -161,6 +161,11 @@ def fail_for_arguments(expected, actual)
doubled_object.to_s.should include("TestClass (fire double)")
doubled_object.inspect.should include("TestClass (fire double)")
end

it 'assigns the class name' do
TestClass.name.should eq("TestClass")
doubled_object.name.should eq("TestClass")
end
end

def reset_rspec_mocks
Expand Down

0 comments on commit 48d85c5

Please sign in to comment.