Rake generate - not generating spec files

Howdy,

I’m running the following stack:

  • rails 3.0.4
  • rake (0.8.7)
  • rspec 2.5.0
  • rspec-rails 2.5.0

I created the rails app, and I didn’t tell rails to exclude the default
Test
mechanisms.

I installed it using

rails generate rspec:install

When I type
rake g model User

I get this:
invoke active_record
create db/migrate/20110223022101_create_users.rb
create app/models/user.rb
invoke test_unit
create test/unit/user_test.rb
create test/fixtures/users.yml

No specs.

When I type
rake -T

I don’t see any spec targets.

When I run rake spec, nothing happens.

Is there something I’ve missed?

Cheers,
Jason

On Feb 22, 2011, at 8:35 PM, Jason N. wrote:

  create      test/unit/user_test.rb

Is there something I’ve missed?

Is rspec-rails in your Gemfile?

group :test, :development do
gem “rspec-rails”, “~> 2.5”
end

On Tue, Feb 22, 2011 at 8:35 PM, Jason N. [email protected] wrote:

I installed it using
rails generate rspec:install
When I type
rake g model User

I’ve got a similar stack to yours. I’ve always run ‘rails g model
User’ (note rails not rake) but if I try ‘rake g’ it spits out an
error, so if you’re running the rails script instead, I could be
wrong.

I don’t see any spec targets.
When I run rake spec, nothing happens.

Is rspec-rails in both your :test and :development groups in your
Gemfile? It needs to be in :development to provide the rake tasks and
generators. See David’s blog [1] for more info.

Is there something I’ve missed?
Cheers,
Jason

-Cole

[1] http://blog.davidchelimsky.net/tag/generators/

I had a similar problem, then I noticed that I didn’t include gem
‘rspec-rails’ in my development environment like what David mentioned
above.
That fixed the problem I had. I’m running the following stack:

  • rails 3.0.3

    • rake (0.8.7)
    • rspec 2.5.0
    • rspec-rails 2.5.0