Open gabrielecirulli opened 10 years ago
I've been downgrading my application to Rails 4 and I'm still encountering this problem. Right now, Spork doesn't seem to be reloading application_helper.rb
.
This behavior seems to stop if I do the following:
config.cache_classes = false
in test.rb
ActiveSupport::Dependencies.clear
at the end of the prefork blockIt only works when both these things are there. It does not work when I do only one of the two.
This is very strange. Is this a known problem? Could you help me figure out what's wrong?
Maybe the gemspec should limit to rails < 4.1 for now?
I am using Rails 4.1 and Ruby 2.1.1. I fixed the reloading issue by specifying
gem 'spork', '~> 1.0rc'
in my Gemfile, and then running
bundle update
in order to update the .lock file.
I've been working on a new Rails
4.1.0.beta1
app (started as such, not upgraded from a previous version), using Ruby2.1.0
, and Spork is giving me some issues.From my
Gemfile.lock
, I'm usingspork-rails (4.0.0)
together withguard (2.4.0)
,guard-rspec (4.2.6)
,guard-spork (1.5.1)
andrspec (2.14.1)
.When I update a model spec and save the changes, it runs correctly (the latest version of said tests is run), but whenever I edit a model and save, Guard detects the change and runs RSpec, but the tests are run against the old version of the code. The code doesn't seem to get reloaded unless I manually restart Spork (which goes against its entire purpose).
In
config/environments/test.rb
I have the following two settings:These are the default settings that I never changed in any of the other Rails
4.0.0
stable projects, but even when changing them I don't get any significant changes in Spork's behavior.Here is a practical example of this issue.
I have a simple
User
model:And the following tests in
spec/models/users_spec.rb
:These tests pass correctly when run, but as soon as I make any change in the model that would obviously stop the tests from passing, such as
validates :username, presence: true, format: { with: /\A\z/ }
, Guard will detect the change, re-run the tests and they'll still be passing, making it seem like the code has not been reloaded by Spork.This might be a problem caused by a change in Rails
4.1.0.beta1
, because I never encountered this when using other stable versions of Rails.I'll be trying to downgrade the app I'm working on to see if I can reproduce this issue, also because I need to proceed and this problem is currently making my workflow harder.