[rspec-users] spec_server not reloading model classes
Andrew Vit
andrew at avit.ca
Sun Mar 29 06:15:48 EDT 2009
On Mar 29, 1:40 am, Scott Taylor <sc... at railsnewbie.com> wrote:
> Actually I meant poking around your app with a browser in dev mode ;)
Ok, I get it, I wasn't sure what you were driving at! ;-) Yes,
everything is reloading fine in the browser under development.
> I'm pretty sure that rails will still try to run the test environment,
> even with RAILS_ENV set to a different value, anyway.
The RAILS_ENV is being set conditionally in my script files, except
script/autospec where it isn't defined.
ENV["RAILS_ENV"] ||= 'test'
> I was thinking of any explicit requires which may occur in app/ and lib/.
Nothing out of the ordinary...
> AFAIK, this is more of a rails loading issue than an rspec one.
I just tried this on a clean new rails app, and the reloading still
doesn't work when running spec_server and autospec with --drb. It
works fine when I'm not using spec_server, but then it reloads all of
rails each time. Works fine, except when using spec_server.
The rspec site says:
[http://rspec.info/rails/runners.html]
> Note that there are some classes and modules that, by default, won’t get reloaded
> by Rails, which means they won’t be reloaded by spec_server. There are a number
> of strategies available for coercing Rails to reload files every time in a given
> environment. See the Rails documentation for more information.
Does that include my app/models? I wouldn't have thought so... Another
post on this mailing list seemed to suggest those don't need manual
reloading and "just work".
$ gem list rails
rails (2.3.2)
$ gem list rspec
rspec (1.2.2)
rspec-rails (1.2.2)
$ rails test_spec_server && cd test_spec_server
$ script/plugin install git://github.com/dchelimsky/rspec-rails.git
$ script/generate rspec
$ script/generate rspec_model car name:string
# edit config/environments/test.rb => config.cache_classes = false
# edit spec/spec.opts => --drb
$ rake spec:server:start
$ script/autospec
# 1 example, 0 failures
# edit app/models/car.rb => add invalid syntax!
# 1 example, 0 failures
Can anyone confirm/reproduce? (Or else tell me what I'm doing wrong?)
Thanks,
Andrew Vit
More information about the rspec-users
mailing list