Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

two spec failures with rails 6.0.3 #155

Closed
boutil opened this issue Oct 13, 2020 · 4 comments
Closed

two spec failures with rails 6.0.3 #155

boutil opened this issue Oct 13, 2020 · 4 comments

Comments

@boutil
Copy link

boutil commented Oct 13, 2020

Hello,

when trying to run the specs with rails 6.0.3 and ruby2.7.2 (Debian unstable), I get the following failures:

Failures:

  1) DataMigrate::DatabaseTasks migrations load_schema_current loads the current schema file
     Failure/Error: subject.load_schema_current
     
     ActiveRecord::AdapterNotSpecified:
       The `development` database is not configured for the `development` environment.
     
       Available databases configurations are:
     
       test: primary, primary, primary, primary
     # /usr/share/rubygems-integration/all/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/connection_specification.rb:250:in `resolve_symbol_connection'
     # /usr/share/rubygems-integration/all/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/connection_specification.rb:218:in `resolve_connection'
     # /usr/share/rubygems-integration/all/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/connection_specification.rb:139:in `resolve'
     # /usr/share/rubygems-integration/all/gems/activerecord-6.0.3.4/lib/active_record/connection_handling.rb:170:in `resolve_config_for_connection'
     # /usr/share/rubygems-integration/all/gems/activerecord-6.0.3.4/lib/active_record/connection_handling.rb:50:in `establish_connection'
     # /usr/share/rubygems-integration/all/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:427:in `load_schema_current'
     # ./spec/data_migrate/database_tasks_spec.rb:101:in `block (4 levels) in <top (required)>'

  2) DataMigrate::DatabaseTasks migrations load_schema_current loads schema file that has not been update with latest data migrations
     Failure/Error: subject.load_schema_current
     
     ActiveRecord::AdapterNotSpecified:
       The `development` database is not configured for the `development` environment.
     
       Available databases configurations are:
     
       test: primary, primary, primary, primary, primary
     # /usr/share/rubygems-integration/all/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/connection_specification.rb:250:in `resolve_symbol_connection'
     # /usr/share/rubygems-integration/all/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/connection_specification.rb:218:in `resolve_connection'
     # /usr/share/rubygems-integration/all/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/connection_specification.rb:139:in `resolve'
     # /usr/share/rubygems-integration/all/gems/activerecord-6.0.3.4/lib/active_record/connection_handling.rb:170:in `resolve_config_for_connection'
     # /usr/share/rubygems-integration/all/gems/activerecord-6.0.3.4/lib/active_record/connection_handling.rb:50:in `establish_connection'
     # /usr/share/rubygems-integration/all/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:427:in `load_schema_current'
     # ./spec/data_migrate/database_tasks_spec.rb:113:in `block (4 levels) in <top (required)>'

Finished in 2.36 seconds (files took 1.97 seconds to load)
47 examples, 2 failures

Is there any prior action required before running rspec in order to ensure it passes?

@ilyakatz
Copy link
Owner

Hm, took a quick look and it seems that starting from version 6.0.3 there is a change that is not backward compatible. I also see the same issue in rails 6.1. Are you familiar with the change (sorry, haven't been in Rails land for over 1.5 years). Do you know what it's about?

@OlegGirko
Copy link

I'm not proficient in Rails, but from what I found from digging in the source code, database in spec is configured for test Rails environment, whereas Rails.env is set to development by default.

Running RAILS_ENV=test rspec spec results in all tests being successful.

@ilyakatz
Copy link
Owner

ilyakatz commented May 7, 2021

can you try the latest version, @lewhit made some changes in other PR's that may have fixed this

@OlegGirko
Copy link

I see changes related to Rails 6.1, but I use Rails 6.0. The workaround with RAILS_ENV=test environment variable is enough for me.

@ilyakatz ilyakatz closed this as completed Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants