Reputation: 355
I have a spork gem issue. Every time I run the spork command I get this long error:
evan@TheBeast-Computer:~/rails_projects/sample_app$ spork
Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
cannot load such file -- /home/evan/rails_projects/sample_app/spec_helper (LoadError)
/home/evan/rails_projects/sample_app/spec/spec_helper.rb:57:in `require_relative'
/home/evan/rails_projects/sample_app/spec/spec_helper.rb:57:in `block in <top (required)>'
/home/evan/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork.rb:24:in `prefork'
/home/evan/rails_projects/sample_app/spec/spec_helper.rb:6:in `<top (required)>'
/home/evan/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:245:in `load'
/home/evan/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:245:in `block in load'
/home/evan/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/evan/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:245:in `load'
/home/evan/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork/test_framework.rb:138:in `block (2 levels) in preload'
/home/evan/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork/app_framework/rails.rb:8:in `preload'
/home/evan/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork/test_framework.rb:134:in `block in preload'
/home/evan/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork.rb:62:in `exec_prefork'
/home/evan/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork/test_framework.rb:120:in `preload'
/home/evan/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork/run_strategy/forking.rb:25:in `preload'
/home/evan/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork/runner.rb:74:in `run'
/home/evan/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork/runner.rb:10:in `run'
/home/evan/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/bin/spork:10:in `<top (required)>'
/home/evan/.rvm/gems/ruby-1.9.3-p194/bin/spork:23:in `load'
/home/evan/.rvm/gems/ruby-1.9.3-p194/bin/spork:23:in `<main>'
Here is my Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.5'
gem 'sqlite3'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
group :development, :test do
gem 'rspec-rails', ">= 2.0.1"
end
group :test do
gem 'rspec-rails', '>= 2.0.1'
gem 'spork', '>= 0.8.4'
end
I'm at a loss of what to do or how to describe my situation. But the result I'm seeing in the Ruby on Rails 3 Tutorial book shows:
$ spork
Using RSpec
Loading Spork.prefork block...
Spork is ready and listening on 8989!
Upvotes: 5
Views: 4608
Reputation: 1
I Had the same problem. I had a
require 'spec_helper'
line within the spec_helper.rb file itself... lets say requiring spec_helper.rb file in a recursive manner. Just eliminate that line and everything is running ok now.
Upvotes: 0
Reputation: 2804
I use Rails 3.2.12 and ruby-1.9.3-p392. In my case, adding require 'spork'
into my Gemfile and running bundle install
did the trick.
Upvotes: 1
Reputation: 659
Just experienced the same problem after a system update. This was due to a missing read privilege on the file.
A simple chmod +r worked for me :
sudo chmod +r /home/evan/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/bin/spork
EDIT
I had once again the problem when updating to Rails 3.2.9 & Ruby 1.9.3-p327. Unfortunately this did not come from acces right issue this time but from a gem that evolved between the two updates (shoulda, to be totally transparent). So if you get this issue, you should also check which file are missing if you have no access right privilege problem and upgrade correctly the corresponding gems.
Upvotes: 10
Reputation: 4617
I actually just ran into the same problem. In my environments/test.rb file, I had set config.cache_classes to true.
In actuality, config.cache_classes needs to be set to false for Spork to work properly.
Upvotes: 0
Reputation: 24394
Had the same problem but was able to go into the spec_help.rb file and just save it. Once I did that it started working.
Upvotes: 1
Reputation: 5110
By the look of it, you have 'spec_helper.rb' file in 'spec' folder which spork tries to load and inside this file on line 57 you have a block inside which you have a require_relative "../spec_helper"
statement which points to 'spec_helper.rb' file in a root project folder and ruby 'cannot load such file' because it's missing.
Upvotes: 1