[rspec-devel] [ rspec-Bugs-11774 ] Mocks should respond to :kind_of? in the same way they respond to :is_a?
noreply at rubyforge.org
noreply at rubyforge.org
Fri Jun 22 17:57:14 EDT 2007
Bugs item #11774, was opened at 2007-06-22 15:48
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=11774&group_id=797
Category: rails plugin
Group: None
Status: Closed
Resolution: Accepted
Priority: 3
Submitted By: Ben Tucker (btucker)
Assigned to: David Chelimsky (dchelimsky)
Summary: Mocks should respond to :kind_of? in the same way they respond to :is_a?
Initial Comment:
Mocks currently respond to :is_a? by matching the class the mock object is mocking. :kind_of? should behave the same.
----------------------------------------------------------------------
>Comment By: Ben Tucker (btucker)
Date: 2007-06-22 21:57
Message:
r2105 brings up a somewhat related other issue
>From the ruby docs:
> obj.is_a?(class) => true or false
> obj.kind_of?(class) => true or false
> Returns true if class is the class of obj, or if class is
> one of the superclasses of obj or modules included in obj.
So the #kind_of? implementation is now correct, but #is_a?
should work like it, not instance_of?
----------------------------------------------------------------------
Comment By: David Chelimsky (dchelimsky)
Date: 2007-06-22 21:43
Message:
Fixed in r2105
Added support for instance_of? too.
----------------------------------------------------------------------
Comment By: Ben Tucker (btucker)
Date: 2007-06-22 16:30
Message:
Yes, sorry, I miscategorized this. I am referring to
mock_model in Spec::Rails.
----------------------------------------------------------------------
Comment By: David Chelimsky (dchelimsky)
Date: 2007-06-22 16:19
Message:
Core mocks don't do this at all. Are you referring to mock_model in Spec::Rails?
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=11774&group_id=797
More information about the rspec-devel
mailing list