views:

32

answers:

1

Hi,

I am new to ROR. I am working on Rspec.. I have been provided with a full package of an application. I kept it in my rails dir. The dir itself contains spec folder with some controllers/models and fixtures but without spec_helper file. So when i run $spec spec/ i got an error

     /usr/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/options.rb:283:in `files_to_load': File or directory not found: spec/ (RuntimeError)

So i simply deleted the whole spec folder. And again created a new spec by

aruna@aruna-desktop:~/railsprojects/appname_c$ script/generate rspec Configuring rspec and rspec-rails gems in config/environments/test.rb ...

  exists  lib/tasks
  create  lib/tasks/rspec.rake
  create  script/autospec
  create  script/spec
  create  spec
  create  spec/rcov.opts
  create  spec/spec.opts
  create  spec/spec_helper.rb

aruna@aruna-desktop:~/railsprojects/appname_c$

after all this .. I try to add the testing spec for my controller Users by

     aruna@aruna-desktop:~/railsprojects/appname_c$ script/generate rspec_controller Users new
     The name 'UsersController' is either already used in your application or reserved by Ruby on Rails.
     Please choose an alternative and run this generator again.
     aruna@aruna-desktop:~/railsprojects/appname_c$ 

I am getting the error as above .. Pls give me suggestions of why i am getting this error. How to resolve this one..

+1  A: 

see this thread on a similar topic. Something in your Rails environment may be defining UsersController before Rspec starts up.

Of course if you can't get the generator working, you can always just create the controller spec file yourself.

zetetic
Ya i have created the Rspec file for the COntroller file instead of using script/generate for creating Rspec file ..
Aruna