I am trying to install rspec-rails on Ubuntu but I am encountering some problems.
Here are my exact steps:
1) Changed my Gemfile to:
source 'http://rubygems.org'
gem 'rails', '3.0.0.beta4'
gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
group :development do
gem 'rspec-rails', '2.0.0.beta.17'
end
group :test do
gem 'rspec', '2.0.0.beta.17'
end
2) Type "bundle install" and I get the following error:
/usr/lib/ruby/1.8/fileutils.rb:243:in `mkdir': Permission denied - /home/steve/.gem/specs (Errno::EACCES)
3) If I continue with my installation instructions and type "rails generate rspec:install" I get the following error (but it might have been caused by #2 failing)
Could not find gem 'rspec (= 2.0.0.beta.17, runtime)' in the gems available on this machine.
I was unable to find a solution for this on Google. This is the link to the tutorial I am trying to follow. My dev enviroment is Ubuntu 10.04, Ruby 1.8.7, Rails 3.0.0 beta 4.
Thanks.
You probably have a permission misconfiguration in your .gem folder. You can reset the permissions using
$ sudo chown -R steve:steve ~/.gem
or you can easily remove the folder and let bundler/rubygems recreate it.
Shouldn't you have rspec being included in the development config too?
I can't test here - but I reckon if you include:
gem 'rspec', '2.0.0.beta.17'
...in your group :development do...end block, that might fix the issue. It would seem logical to me as I think rspec-rails needs the rspec functionality itself in order to be able to generate the necessary files. You're probably safer as well if you make the blocks like this:
group :development do
gem 'rspec', '2.0.0.beta.17'
gem 'rspec-rails', '2.0.0.beta.17'
end
group :test do
gem 'rspec', '2.0.0.beta.17'
gem 'rspec-rails', '2.0.0.beta.17'
end
...as that way the necessary files should be getting included in both environments. I don't know for sure, I just hope this hasn't confused matters further (I'm a total Rails newbie!)
If changing ownership of your ~/.gem folder doesn't work try checking the ownership of the folder you are currently in. To check your folder permissions type:
$ ls -la
If you see anything that says "root root" it needs to be changed to your current user account.
$ sudo chown -R steve:steve /path/to/folder
just remove .bundle
directory in your application path
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With