spec server not reloading plugins
Reported by brian (at fremontforward) | February 11th, 2008 @ 08:38 PM
When I run spec_server using:
ruby script\spec_server
and then execute my specs using:
spec .\spec\ -X
the first run through seems to work fine. The second time through I get all sorts of errors saying:
"Role expected, got Role"
I'm using the authorization plugin which relies on roles. This error seems to be related to this problem (last issue discussed): http://blog.spotstory.com/2007/0....
I'm using:
Win XP
Ruby 1.8.6
Rails 2.0.2
RSpec 1.1.3
Thanks!
Comments and changes to this ticket
-
David Chelimsky February 12th, 2008 @ 01:48 AM
- → State changed from new to open
Please post some code please?
Also - is this only when you're using spec_server? i.e. Do the specs pass repeatedly if you run the specs using rake?
-

brian (at fremontforward) February 12th, 2008 @ 07:04 PM
Thanks for the response, David. The problem only occurs when using spec_server. I can run the specs multiple times w/o the spec_server, and they pass fine.
As the link above suggests, it seems to pertain to caching of plugin code, while reloading associated application code. I see somewhat similar behavior when running my rails app in development mode and trying to use the acts_as_commentable plugin to add comments. First time it works fine, second time I get a "User expected, got User" error. If I set config.cache_classes = true, works fine. I added this code to my development.rb file, and the problem seems to have gone away in development:
reloadable_plugins = ["acts_as_commentable", "acts_as_rateable", "authorization", "engines", "savage_beast", "streamlined"] # Force these plugins to reload, avoiding stale object references. reloadable_plugins.each do |plugin_name| reloadable_path = RAILS_ROOT + "/vendor/plugins/#{plugin_name}/lib" Dependencies.load_once_paths.delete(reloadable_path) endI was NOT experiencing this problem in development before I upgraded to Rails 2.0.2 from 1.2.3. I can't speak for RSpec because I didn't start using it until after the upgrade.
Thanks!
-

Derk Bell June 15th, 2008 @ 04:03 PM
I had the same Role expected, got Role and AssociationTypeMismatch errors when running with spec_server. Normal runs were doing fine.
I fixed this by setting config.cache_classes = false in environments/test.rb
-
David Chelimsky June 15th, 2008 @ 08:55 PM
- → Assigned user changed from to David Chelimsky
Sounds like cache_classes = false is the trick. So can we consider this closed?
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Behaviour Driven Development for Ruby.
