Shikasan
Shikasan

Reputation: 329

Ruby rspec test command: could not locate Gemfile

I just installed Ruby 1.9.3 on Windows 7 and I also installed rubygems. I'm trying to work with rspec so I ran: gem install rspec

It seemed to work well and everything installed. SO I went on to try the example on this page. But anytime I run the rspec command I get this error message:

"Could not locate Gemfile".

According to the example, I should get: "./bowling_spec.rb:4: uninitialized constant Bowling"

I've googled it and it was suggested I try bundle exec rspec but it still yielded the same results. I have also tried the suggestion on this page but it yields the same results. What am I doing wrong? Thanks

Upvotes: 1

Views: 2169

Answers (2)

Ismael
Ismael

Reputation: 16720

Create the Gemfile with this content. Gemfile can have no extension or .gem extension

source 'https://rubygems.org'
gem 'rspec'

so you have

app/
  Gemfile or Gemfile.gem
  spec/
    bowling_spec.rb

Also you might need to execute this commands after

gem install bundler

and then, in the app directory

bundle install

Upvotes: 2

nikkypx
nikkypx

Reputation: 2005

gem install rspec in the same directory as your app and change require statement to require './bowling.rb'

Upvotes: 1

Related Questions