I just run in the following problem when starting a Rails app on my
production server:
You have rspec rake tasks installed in
/home/thomas/rails_apps/video_on_demand/lib/tasks/rspec.rake,
but rspec can not be found in vendor/gems, vendor/plugins or on the
system.
Obviously I don’t want Rails to load anything related to rspec, how can
I tell Rails that it should not care about RSpec on the production
environment?
A quick fix is to install rspec and rspec-rails gems on production
server, but I don’t get why the app wants them installed.
Obviously I don’t want Rails to load anything related to rspec, how
can
I tell Rails that it should not care about RSpec on the production
environment?
A quick fix is to install rspec and rspec-rails gems on production
server, but I don’t get why the app wants them installed.
I would delete that rake task file (lib/rspec.rake) if you don’t have
rspec installed.
I would delete that rake task file (lib/rspec.rake) if you don’t have
rspec installed.
Scott
I run rspec on my dev machine, but obviously not on my production
machine, what would be the nicest way to handle such scenario? At the
top of rspec.rake I could add a check on the environment, I could also
not add this file to my repository but I could forget about this file in
future clones of my repo, etc.
On Fri, Jan 16, 2009 at 1:38 PM, Fernando P. [email protected]
wrote:
Obviously I don’t want Rails to load anything related to rspec, how can
I tell Rails that it should not care about RSpec on the production
environment?
A quick fix is to install rspec and rspec-rails gems on production
server, but I don’t get why the app wants them installed.
This is a tricky business.
We put that in there in response to a user who works on a team. One
team member had pulled code and tried t run specs and got an error he
didn’t understand, so this is intended to help that developer know he
needs to install rspec.
So now this creates a new problem for you, which is that this means
you have to have rspec installed everywhere you want to run rake
tasks.
I’m open to suggestions for how to best solve for both cases if you have
any.
On Fri, Jan 16, 2009 at 1:15 PM, Fernando P. [email protected]
wrote:
I run rspec on my dev machine, but obviously not on my production
machine, what would be the nicest way to handle such scenario? At the
top of rspec.rake I could add a check on the environment
That would get my vote.
Unless I"m missing something, that would require this on the CLI:
On Fri, Jan 16, 2009 at 1:15 PM, Fernando P. [email protected]wrote:
I run rspec on my dev machine, but obviously not on my production
machine, what would be the nicest way to handle such scenario? At the
top of rspec.rake I could add a check on the environment
I’d most certainly add it to the repos in the form of a plugin.
What exactly are you worried about? The memory overhead of loading
the rspec code? (I’m not sure exactly how rails works here - does it
simply rspec/lib/ to the $LOAD_PATH? Does it require lib/spec.rb?)
Obviously if your production code is explicitly calling rspec, you’ve
got bigger problems.
Because the rake tasks get loaded before the spec task has a chance to
set
RAILS_ENV. But the rakefile wouldn’t check RAILS_ENV=test, but
RAILS_ENV=production (or staging). And wouldn’t it be set that way
before
rake loads its files? (I’m gonna learn something here, whether I want to
or
not!)
Make it print the message to STDERR instead of raising an error? Plus
add a
blurb like “You can ignore this warning if you didn’t intend to run
specs”
Aslak
I like that too, +1 for me.
Obviously if your production code is explicitly calling rspec, you’ve
got bigger problems.
As Stephen said, it’s because rspec.rake located under the lib folder is
trying to load rspec (gem or plugin) without looking at the rails
environment.
I copy the schema from production, the server doesnt have a
development database.
also, my opts default to --format html so i can browse to the results
From my Capfile
task :spec, :roles => :app do
run “cd #{current_path} && rake db:test:prepare
RAILS_ENV=production” # copy schema from production rather than
development
run "cd #{current_path} && rake spec RAILS_ENV=production
A quick fix is to install rspec and rspec-rails gems on production
server, but I don’t get why the app wants them installed.
This is a tricky business.
We put that in there in response to a user who works on a team. One
team member had pulled code and tried t run specs and got an error he
didn’t understand, so this is intended to help that developer know he
needs to install rspec.
So now this creates a new problem for you, which is that this means
you have to have rspec installed everywhere you want to run rake
tasks.
I haven’t followed the ML latety, but it seems that now I don’t have to
install rspec and its friends on the production server anymore.