Rails Rspec test fails: Failure/Error: FATAL: database "jmschp" does not exist

I have a project with Rails 5.2.4.5. Where I am using Rspec for testing, and Postgres as database.

RSpec 3.10
  - rspec-core 3.10.1
  - rspec-expectations 3.10.1
  - rspec-mocks 3.10.2
  - rspec-support 3.10.2

When I run rails spec:helpers I am getting the following error:

An error occurred while loading ./spec/helpers/pluralize_without_count_helper_spec.rb.
Failure/Error: ActiveRecord::Migration.maintain_test_schema!

ActiveRecord::NoDatabaseError:
  FATAL:  database "jmschp" does not exist
# ./spec/rails_helper.rb:30:in `<top (required)>'
# ./spec/helpers/pluralize_without_count_helper_spec.rb:1:in `<top (required)>'
# ------------------
# --- Caused by: ---
# PG::ConnectionBad:
#   FATAL:  database "jmschp" does not exist
#   ./spec/rails_helper.rb:30:in `<top (required)>'
No examples found.

I have droped the data base and recreated it again.

In my database.yml I have:

default: &default
  adapter: postgresql
  encoding: unicode
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 6 } %>

development:
  <<: *default
  url: <%= ENV['DATABASE_URL'] %>
  database: store_development

test:
  <<: *default
  url: <%= ENV['TEST_DATABASE_URL'] %>

In development work fine. How can I fix this?



Read more here: https://stackoverflow.com/questions/66305086/rails-rspec-test-fails-failure-error-fatal-database-jmschp-does-not-exist

Content Attribution

This content was originally published by Miguel Hargreaves Pimenta at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: