Came across this error when trying out the ruby on rails tutorial section with rspec on a windows platform using jruby 1.6:
c:\\rails_projects\\sample_app>
This might be of some use - in the event rpsec
wasn't installed properly on a Win7 environment.
rails3 rspec issue
After running
rails generate rspec:install
Place your *_spec.rb
files under (in your example) c:\rails_projects\sample_app\spec\model
. Then specify relative path with require_relative
require_relative '../spec_helper'
Run the following command
c:\rails_projects\sample_app>rails generate rspec:install
This will put the spec_helper.rb
file in your /spec
directory
When you execute 'rails generate rspec:install'
, if you see 'Could not find generator rspec:install'
error message, add gem 'rspec-rails'
within :developnent
, :test
group in your project Gemfile
as shown below.
group :development, :test do
gem 'rspec-rails'
end
After this, execute 'bundle install'
and continue with 'rails generate rspec:install'
I had the same problem but for a different reason:
in my spork.prefork
block within my spec_helper.rb
file I had this line
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
but within one of the files that was being required above (spec/support/some_helper_file.rb
) was a require 'spec_helper'
call
removing this unneeded require solved the issue