Reputation: 8631
I am trying to create an rspec for my model User but every time I run:
rails g rspec_model User
I get Could not find generator rspec_model.
I checked another stackoverflow thread and it said make sure I have the gem 'rspec-rails' and I do. What am I doing wrong? Here's my gemfile:
group :test do
# Pretty printed test output
gem 'turn', :require => false
gem 'rspec', '2.0.1'
gem 'webrat', '0.7.1'
end
group :development do
gem 'rspec-rails', '2.0.1'
gem 'sqlite3'
end
Upvotes: 2
Views: 1266
Reputation: 1180
rails g rspec:model Movie
rails g rspec:model Movie --fixture #tested in rails 3.1 for rspec 2.8.0
Upvotes: 0
Reputation: 96484
Please use (once):
rails generate rspec:install
It will create the various files and the spec directory. You will then need to, for example, create the models directory and start creating specs in that directory.
Once you configure your application for rspec, script/rails generate ModelName will also create the rspec skeleton files I believe.
Upvotes: 6