"rspec can not be found in vendor/gems, vendor/plugins or system gems" error

I’m trying to follow the instructions in the beta version of “The RSpec
Book” to get “BDD in Rails” going. Here are some relevant details:

Rails version: 2.3.5

Local gems:
rspec (2.1.0)
rspec-core (2.1.0)
rspec-expectations (2.1.0)
rspec-mocks (2.1.0)
rspec-rails (1.3.2)

I started by installing rspec-rails 1.3.2, then cucumber-rails 0.3.2,
then database_cleaner and webrat. I then tried to run rake spec and got
the “rspec can not be found” error message. Taking this message
literally, I then ran “gem install rspec” and was able to install the
rspec-2.1.0 gem.

But when I ran rake spec again, I got the same error message as before.
Should I have installed an earlier version of the rspec gem?

Thanks,

Dean R.

On Nov 8, 2010, at 12:40 PM, Dean R. wrote:

rspec-rails (1.3.2)

I started by installing rspec-rails 1.3.2, then cucumber-rails 0.3.2,
then database_cleaner and webrat. I then tried to run rake spec and got
the “rspec can not be found” error message. Taking this message
literally, I then ran “gem install rspec” and was able to install the
rspec-2.1.0 gem.

But when I ran rake spec again, I got the same error message as before.
Should I have installed an earlier version of the rspec gem?

Did you get the most recent update to the beta book? If not, go log into
your PragProg account and get it. There’s a section in the preface that
lists all the versions you need, including Rails-3 (not rails-2.3.5) and
RSpec-2.

HTH,
David

David C. wrote in post #960173:

On Nov 8, 2010, at 12:40 PM, Dean R. wrote:

rspec-rails (1.3.2)

I started by installing rspec-rails 1.3.2, then cucumber-rails 0.3.2,
then database_cleaner and webrat. I then tried to run rake spec and got
the “rspec can not be found” error message. Taking this message
literally, I then ran “gem install rspec” and was able to install the
rspec-2.1.0 gem.

But when I ran rake spec again, I got the same error message as before.
Should I have installed an earlier version of the rspec gem?

Did you get the most recent update to the beta book? If not, go log into
your PragProg account and get it. There’s a section in the preface that
lists all the versions you need, including Rails-3 (not rails-2.3.5) and
RSpec-2.

HTH,
David

David:

Thanks for prompting me to get the update of the book. So, if I’m not
quite ready to make the leap to Rails 3, am I out of luck trying to use
RSpec and Cucumber? Is there any intermediate strategy you can suggest?

–Dean

David:

Thanks for your help. I’ve followed the set-up instructions in the “BDD
in Rails” chapter successfully up to the “rake db:test:prepare” step. At
that point, I get the following error:

rake aborted!
no such file to load – sqlite3

I’ve attached a document containing my “gem list” output showing the
presence of the sqlite3-ruby gem and other associated dependencies. The
document also gives the content of my database.yml file for reference.
I’m using mysql for my development and production databases.

When I try to switch my test database to mysql too, by editing the
“test:” section of database.yml, I get the following error:

rake aborted!
Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

Both of these errors are widely-discussed on message boards, stack
overflow, etc., but none of the fixes I’ve found so far there seem to
help.

Any suggestions for how to make either test database approach (sqlite3
or mysql) work would be greatly appreciated.

Thanks again for your help,

Dean R.

David C. wrote in post #960323:

On Nov 9, 2010, at 6:38 AM, Dean R. wrote:

David:

Thanks for prompting me to get the update of the book. So, if I’m not
quite ready to make the leap to Rails 3, am I out of luck trying to use
RSpec and Cucumber? Is there any intermediate strategy you can suggest?

rspec-1.3 works fine with rails-2.3, and there are notes about how to
set this up in the “BDD in Rails” chapter.

The RSpec Book is more of a workflow/strategy/process book than a
recipe/syntax book. The latter is present, but not the focus. I’d
recommend using the versions in the book (listed in the preface) to go
through the exercises so you can learn how to use these tools
effectively, and then comb the interwebs for information about whatever
syntactic differences might be missing from the book. You can also write
to this list if you have questions about the differences between
versions.

HTH,
David

Hi Dean

it seems that you have sqlite3-ruby installed, but not sqlite3 installed

‘gem install sqlite3’ might fix it ?

cheers

Paul

On Nov 9, 2010, at 6:38 AM, Dean R. wrote:

David:

Thanks for prompting me to get the update of the book. So, if I’m not
quite ready to make the leap to Rails 3, am I out of luck trying to use
RSpec and Cucumber? Is there any intermediate strategy you can suggest?

rspec-1.3 works fine with rails-2.3, and there are notes about how to
set this up in the “BDD in Rails” chapter.

The RSpec Book is more of a workflow/strategy/process book than a
recipe/syntax book. The latter is present, but not the focus. I’d
recommend using the versions in the book (listed in the preface) to go
through the exercises so you can learn how to use these tools
effectively, and then comb the interwebs for information about whatever
syntactic differences might be missing from the book. You can also write
to this list if you have questions about the differences between
versions.

HTH,
David

On Thu, Nov 11, 2010 at 9:49 AM, Dean R. [email protected]
wrote:

presence of the sqlite3-ruby gem and other associated dependencies. The
overflow, etc., but none of the fixes I’ve found so far there seem to
help.

Any suggestions for how to make either test database approach (sqlite3
or mysql) work would be greatly appreciated.

Hello,

To better understand what is going on with sqlite3 adapter will
require more details.

As for the mysql error, in your database.yml, just copy your
configuration from development section and rename the database to your
test one.

Ensure the socket line is not there, as is the one affecting your
mysql execution.

HTH,

Luis L.
AREA 17

Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupry

Paul:

Thanks for taking the time to respond… that sounds like an
attractively simple solution. When I go to try it, though, I’m told that
the sqlite3 gem requires at least Ruby 1.9.1, and I’m still working with
1.8.7. Also, I’m already running a bunch of applications on this machine
(MBP) that use sqlite3 successfully.

Is there a version of sqlite3 that might help eliminate the error but
which doesn’t require Ruby 1.9.1? Or is the upgrade path the only one
that’s likely to work for me?

Again, thanks for your help…

–Dean

Paul N. wrote in post #960723:

Hi Dean

it seems that you have sqlite3-ruby installed, but not sqlite3 installed

‘gem install sqlite3’ might fix it ?

cheers

Paul

Hi Luis:

Thanks for the rapid response. I’ll work on your MySQL fix… in the
meantime, what further details can I provide regarding the sqlite3
adapter issue?

–Dean

Luis L. wrote in post #960735:

On Thu, Nov 11, 2010 at 9:49 AM, Dean R. [email protected]
wrote:

presence of the sqlite3-ruby gem and other associated dependencies. The
overflow, etc., but none of the fixes I’ve found so far there seem to
help.

Any suggestions for how to make either test database approach (sqlite3
or mysql) work would be greatly appreciated.

Hello,

To better understand what is going on with sqlite3 adapter will
require more details.

As for the mysql error, in your database.yml, just copy your
configuration from development section and rename the database to your
test one.

Ensure the socket line is not there, as is the one affecting your
mysql execution.

HTH,

Luis L.
AREA 17

Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupry

Luis:

This was really helpful advice. I went ahead and simply created the
“showtime” rails app using the guidelines under section 19.3 of The
RSpec Book:

No problems whatsoever with rake db:test:prepare. This should have been
obvious to me because I just went through that chapter a few weeks back.

I then went into the config directory for showtime and changed the
database.yml file… so that the development and test sections looked
like they do in my genlighten app. I repeated rake db:test:prepare, and
it still worked fine.

Of course, when I went through Michael H.'s Rails Tutorial book
several months ago, I was able to use rspec and rake db:test:prepare
there successfully, in another directory on my same machine, so it
shouldn’t surprise me that a “clean” app works.

Unfortunately, however, I’m afraid I’m still clueless as to what’s so
different about the genlighten app’s configuration/setup that it fails
to find sqlite3 (if that’s even what’s really going on…)

–Dean

BTW, your suggested fix to the “test:” section in my database.yml file
for using mysql on my test database worked flawlessly. Thanks!

Luis L. wrote in post #960752:

On Thu, Nov 11, 2010 at 11:40 AM, Dean R. [email protected]
wrote:

Hi Luis:

Thanks for the rapid response. I’ll work on your MySQL fix… in the
meantime, what further details can I provide regarding the sqlite3
adapter issue?

If you can create a simple new rails application it will use sqlite3
by default, try to execute rake db:migrate and db:test:prepare there
and see if the error is reproducible.

Luis L.
AREA 17

Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupry

On Thu, Nov 11, 2010 at 11:40 AM, Dean R. [email protected]
wrote:

Hi Luis:

Thanks for the rapid response. I’ll work on your MySQL fix… in the
meantime, what further details can I provide regarding the sqlite3
adapter issue?

If you can create a simple new rails application it will use sqlite3
by default, try to execute rake db:migrate and db:test:prepare there
and see if the error is reproducible.

Luis L.
AREA 17

Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupry

On Nov 11, 2010, at 7:53 AM, Dean R. wrote:

that’s likely to work for me?

Again, thanks for your help…

You need the sqlite3 library (not the sqlite3 gem) and the sqlite3-ruby
gem.

HTH,
David

Luis:

Since your suggested change to database.yml got rake db:test:prepare to
work when using mysql for the test database, I went ahead and tried to
rake spec and rake cucumber for my app.

“rake spec” produced the same error that originally led to this thread:

rake aborted!


  • You are trying to run an rspec rake task defined in
  • /Users/Lowell/rails_projects/genlighten_dr/lib/tasks/rspec.rake,
  • but rspec can not be found in vendor/gems, vendor/plugins or system
    gems.

Fortunately, however entering ‘spec spec/’ works fine (i.e., produces no
output and a command prompt, since my app currently has no tests.)

I worry that I have some gems in

 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby 

/gems/1.8/gems

(rails 2.3.5, for instance, but not rspec or cucumber) and lots of other
gems in

 /Library/Ruby/Gems/1.8/gems

(another copy of rails 2.3.5, plus rspec and components, cucumber and
components, and a ton of other stuff)

and that the rake task is confused about where to look.

Any suggestions on whether that might be the issue and if so, how to
address it?

Thanks once more…

Dean

Luis L. wrote in post #960735:

On Thu, Nov 11, 2010 at 9:49 AM, Dean R. [email protected]
wrote:

presence of the sqlite3-ruby gem and other associated dependencies. The
overflow, etc., but none of the fixes I’ve found so far there seem to
help.

Any suggestions for how to make either test database approach (sqlite3
or mysql) work would be greatly appreciated.

Hello,

To better understand what is going on with sqlite3 adapter will
require more details.

As for the mysql error, in your database.yml, just copy your
configuration from development section and rename the database to your
test one.

Ensure the socket line is not there, as is the one affecting your
mysql execution.

HTH,

Luis L.
AREA 17

Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupry