0

I've installed rspec through rails g rspec:install. ANd according to the documentation of rspec that would suffice to create models (model_spec.rb)

So I created a model right after rails g model group name:string. It creates a test_unit model but no rspec model. using generate instead of g didn't help either.

Here's my test-part of my gemfile:

group :test do
  gem 'guard-rspec'
  gem 'capybara', '~> 2.0'
  gem 'factory_girl_rails', '~> 4.2'
  gem 'rspec-rails', '~> 2.14'
  gem 'fuubar'
  gem 'cucumber-rails', require: false
  gem 'guard'
  gem 'guard-bundler'
  gem 'guard-cucumber'
  gem 'rb-inotify', require: false
  gem 'rb-fsevent', require: false
  gem 'rb-fchange', require: false
  gem 'growl'
  gem 'shoulda'
  gem 'simplecov', require: false 
end

Am I forgetting something perhaps?

2
  • Do you mean the model_spec.rb files aren't being created? Commented Oct 19, 2013 at 9:06
  • Yes. I'll rephrase my question. Sorry. Commented Oct 19, 2013 at 9:07

1 Answer 1

5

You need to add the gem to the development group too. According to the rspec-rails GitHub page:

Add rspec-rails to both the :development and :test groups in the Gemfile:

rspec-rails on GitHub

After that bundle install and rails generate rspec:install

Sign up to request clarification or add additional context in comments.

2 Comments

adding it to group :development, :test did nothing to fix it I'm afraid.
Ah, got it. It's handy to save before you bundle... Your solution did the trick!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.