Test

Tests - Models

RSpec useful commands:

rspec spec/auth 

Will run only the tests in the spec/auth directory

rspec -fd 

Will format and group the results. rspec -h for more details

Troubleshooting

I had an issue with FactoryBot where the factories were not recognized. The solution was to add this to spec/spec_helper.rb:

config.before(:all) do
  FactoryBot.reload
end

If you come up with an issue where all tests fails with the following error:

ActiveRecord::NoDatabaseError:
  FATAL:  database "minerva_api_test" does not exist

Try the following command:

rails db:test:prepare

How to run single tests

bundle exec rspec ./spec/requests/api/v1/authenticate_user_spec.rb