Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

instance_of? not functioning correctly on second run #33

Open
mattbeedle opened this issue May 31, 2013 · 3 comments
Open

instance_of? not functioning correctly on second run #33

mattbeedle opened this issue May 31, 2013 · 3 comments

Comments

@mattbeedle
Copy link

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

@nilbus
Copy link
Collaborator

nilbus commented May 31, 2013

Yes, very likely related.

@nilbus nilbus closed this as completed May 31, 2013
@nilbus nilbus reopened this May 31, 2013
@mattbeedle
Copy link
Author

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?

@mattbeedle
Copy link
Author

OK, I found the cause. It happens when class caching is turned off in config/environments/test.rb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants