rspec not creating test models when generating model

CaptainCarl

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?

jcm

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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can I tell Rails to use RSpec instead of test-unit when creating a new Rails app?

Creating rspec files for existing model (beginner)

Rails 4, rspec 3: model validation test

Class 'App\models\Test' not found when try to access model

When creating a custom User model in Django what is the difference between inheriting from models.Model and AuthUser?

JMeter error when generating dashboard at end of test

Creating a wordvector model combining words from other models

RSpec model validation test error in Proc

Model Validation fails in RSpec when I add custom validation in model

Running rspec test twice when result is stochastic

Rspec not working when rails_env=test

Why doesn't my rspec test pass when my model validation fails as it should

What to add to RSpec valid_attributes when it is validating related models

Generating new model is not possible after creating model in active admin for that in ROR

NoMethodError when running RSpec test

Rspec test failed when expecting ordered array

UrlGenerationError when running RSpec Test

Rspec: model not updated when submitting form with js

sailsjs error handling when creating two models

Django test client, not creating models (--keepdb option being used)

How do I test associations in models with RSpec in Rails 5?

Rspec test passing only when there's a PUTS in the model

how to write rspec test for scope in model

test for models that points itself rspec rails 5

Rails 5.2 rspec - How to test if a model is actually using a custom validator?

Rails/Rspec - How to stub a model method inside of a controller test?

How to test "Model.valid?" on a FactoryBot generated model using Rspec?

Generating unique random values along with a series - creating test data for postgresql

Error creating model "segmentation_models" in Keras