guard-jruby-rspec
guard-jruby-rspec copied to clipboard
instance_of? not functioning correctly on second run
The first time around all of my tests pass. The second time around I have failures related to ActiveRecord equality comparisons.
This fails for example
User.deactivated.should include(user)
Taking a closer look:
user.class # => User(id: integer, email: string, encrypted_password: string, .........)
user.instance_of?(user.class) # => true
User.deactivated.first.class # => User(id: integer, email: string, encrypted_password: string, .........)
User.deactivated.instance_of(user.class) # => false
u = User.new
u.instance_of?(user.class) # => false
u.instance_of?(User.deactivated.class) # => true
I think this issue may be related to #31
/cc @nilbus
Yes, very likely related.
I tried creating a bare bones rails app, just with devise, fabrication and rspec and this seems to work fine there:
https://github.com/mattbeedle/guard_jruby_rspec_example
So, I'm not totally sure where to start looking for this issue now. Any ideas? Maybe I should try adding all the additional gems from my main app 1 by 1?
OK, I found the cause. It happens when class caching is turned off in config/environments/test.rb.