Can't get RSpec 2.3.1 to work in Rails 3.0.3 - uninitialized constant Rails (NameError)

I just installed rspec-rails 2.3.1 gem into a new Rails 3.0.3 app, ran
the rspec:install generator, but the system doesn’t see any other
RSpec generators (like rspec_controller), and the server will no
longer start.

Both report this error:

/.rvm/gems/ruby-1.9.2-p0@rails3/gems/rspec-rails-2.3.1/lib/rspec-
rails.rb:3:in `module:Rails’: uninitialized constant Rails
(NameError)

Here’s a clip of the file referenced by the error:

module RSpec
module Rails
class Railtie < ::Rails::Railtie

I’ve used RSpec 2.0 and 2.1 with Rails 3 before without problems. Any
suggestions greatly appreciated…

On Dec 30, 2010, at 4:37 PM, Kurt wrote:

I just installed rspec-rails 2.3.1 gem into a new Rails 3.0.3 app, ran
the rspec:install generator, but the system doesn’t see any other
RSpec generators (like rspec_controller),

There is an rspec:controller generator, but Rails hides it from you
because it is intended (by Rails) to be run with the Rails controller
generator. When you run rails generate controller Accounts name:string, Rails generates the controller file and then delegates to
RSpec to run the spec file.

and the server will no longer start.

The server? What command are you typing?

class Railtie < ::Rails::Railtie

I’ve used RSpec 2.0 and 2.1 with Rails 3 before without problems. Any
suggestions greatly appreciated…


rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Cheers,
David