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

Class reloading for Rails projects #29

Open
nilbus opened this issue May 16, 2013 · 5 comments · Fixed by #31
Open

Class reloading for Rails projects #29

nilbus opened this issue May 16, 2013 · 5 comments · Fixed by #31

Comments

@nilbus
Copy link
Collaborator

nilbus commented May 16, 2013

Right now I'm working on a module that will kick in for rails projects that will use ActionDispatch::Reloader to reload rails classes the right way (like it does in development environment) rather than using load. Using load can be problematic for several reasons. Removing methods and classes in the code does not cause them to be undefined. Using RSpec 1 and maybe other test frameworks, each test run makes new duplicate copies of each spec, and the old copies still fail if they originally were. In general, it's not idempotent. This patch I'm working on this morning should fix that for Rails >= 3.1 projects.

Any thoughts on this?

@jkutner
Copy link
Owner

jkutner commented May 16, 2013

I would definitely be interested in accepting something like that (as long as it works on projects that are not rails, too). But I don't think I have any insight to how it should be done. Nonetheless, let me know if I can help with questions.

@nilbus
Copy link
Collaborator Author

nilbus commented May 16, 2013

Yes, I definitely intend to make it continue working as is for all rails versions and non-rails projects.

I'm finding that it may be useful to integrate with spork when it's available too. A typically Rails project that uses spork has in the spec_helper.rb a Spork.each_run block that contains things that need to happen after each run like DatabaseCleaner.clean that need to be executed before each test run to make subsequent runs successful.

@mattbeedle
Copy link

👍 this would be really awesome

@nilbus
Copy link
Collaborator Author

nilbus commented May 28, 2013

I'll see if I can put together a pull request today with what I have
working.

@nilbus
Copy link
Collaborator Author

nilbus commented Jun 3, 2013

This isn't working properly. Some modification after my initial tests is causing class unloading not to work. A method that gets deleted is not undefined for subsequent test runs.

@nilbus nilbus reopened this Jun 3, 2013
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

Successfully merging a pull request may close this issue.

3 participants