[rspec-users] [cucumber] Tests pass, application does not.
dchelimsky at gmail.com
Thu Apr 9 14:12:04 EDT 2009
On Thu, Apr 9, 2009 at 2:48 PM, Joseph Wilk <joe at josephwilk.net> wrote:
> James Byrne wrote:
>> James Byrne wrote:
>>> This has just cropped up this morning and I have no clue as to what is
>>> causing it.
>>> Here is the error when running the application through the web browser
>>> in development:
>>> undefined method `method_exists?' for #<Entity:0x2b7214243bd0>
>> I put in a print self.methods.sort.to_yaml and, sure enough, when I do
>> this through the browser this is what I see:
>> - mark_for_destruction
>> - marked_for_destruction?
>> - metaclass
>> - method
>> - method_missing
>> - methods
>> - new_record?
>> - nil?
>> - object_id
>> I put the same check in the controller
>> @entity = Entity.new
>> print @entity.methods.sort.to_yaml
>> and it is missing there as well.
>> No method_exists?, So, where is it going?
> Could be completely off track, Pats mention of Mocha reminded me that Rails
> 2.3 tests have lots of 'require mocha' dotted around the place:
It's not just in Rails' own tests. It's actually in
ActiveSupport::TestCase, which means that if you have mocha installed,
it's getting loaded whether you use it or not.
Generally speaking, this should really not be a problem. But there are
those odd cases where a conflict may arise because both rspec-mocks
and mocha add methods to object to support partial mocking/stubbing on
any object. It happens that they use different method names. But, for
example, if we wanted to alias :should_receive with :expects in RSpec
to give it more of mocha's flavor, we'd be definitely be risking some
> David raised a ticket on this:
> Could this be causing some conflict?
> Joseph Wilk
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users