-
Notifications
You must be signed in to change notification settings - Fork 630
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
Custom inputs no longer automatically found in Spork environment #851
Comments
Thanks rmm5t, we've run into the same problem with our project and your patch works great here too. |
+1, had the same problem and the workaround works ;-) |
Thanks rmm5t, +1 from me too. Definitely worth adding a note to the README. The wiki on the spork github project also has a bunch of spec_helper example snippets showing how to avoid problems with common gems (devise, factory_girl etc.). Formtastic is clearly worth adding to that list too. |
This is also an issue in spring. Spring is setting the loading mechanism to This patch solves the issue for Spring (and it appears to have the same general effect as the current code): https://gist.github.com/rjackson/5096208. |
+1, we had the same problem with our project. We're using the surveyor gem which relies on formtastic. Thanks rmm5t, your workaround worked for us too, after modifying it to work on the surveyor gem's app/inputs folder: surveyor_path = Gem.loaded_specs['surveyor'].full_gem_path
Dir["#{surveyor_path}/app/inputs/*_input.rb"].each { |f| require File.basename(f) } |
Closing, as the work-around is documented and there's been a lack of activity here. |
After upgrading from Formtastic 2.0.x to 2.2.0, my custom inputs were no longer automatically found during my controller tests ("functional" tests). Upon further review, I think this is because of the new behavior surrounding the
cache_classes
config while searching for input classes and because I use Spork in my test environment.My current workaround is to require all the classes in
app/inputs
inside Spork'sprefork
block:I'm opening this up here in hopes of feedback, a more elegant fix, and/or helping someone else with a similar problem. If this warrants a README update, I'd be happy to write the addition. If not, feel free to close.
The text was updated successfully, but these errors were encountered: