uninitialized constant ActiveRecord::DatabaseConfigurations::ConnectionUrlResolver::URI
还没有人认领这个 Issue。
评估
调研方向
使用 Ruby 2.7.2 和 Rails 6.1.3.1,通过 bundle exec rspec 重现该失败。先从 vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.3.1/lib/active_record/database_configurations/connection_url_resolver.rb:47 开始,然后从 spec/rails_helper.rb:3 追踪加载过程;当 specs 能够在没有所报告的 NameError 的情况下加载时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
I run my specs on Gitlab CI. When I try to run bundle exec rspec I get:
-----> Running test: bundle exec rspec
An error occurred while loading ./spec/auth/authenticate_user_spec.rb.
Failure/Error: require 'database_cleaner'
NameError:
uninitialized constant ActiveRecord::DatabaseConfigurations::ConnectionUrlResolver::URI
# ./vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.3.1/lib/active_record/database_configurations/connection_url_resolver.rb:47:in `uri_parser'
# ./vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.3.1/lib/active_record/database_configurations/connection_url_resolver.rb:25:in `initialize'
# ./vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.3.1/lib/active_record/database_configurations/url_config.rb:48:in `new'
# ./vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.3.1/lib/active_record/database_configurations/url_config.rb:48:in `build_url_hash'
# ./vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.3.1/lib/active_record/database_configurations/url_config.rb:38:in `initialize'
# ./vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.3.1/lib/active_record/database_configurations.rb:262:in `new'
# ./vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.3.1/lib/active_record/database_configurations.rb:262:in `environment_url_config'
# ./vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.3.1/lib/active_record/database_configurations.rb:177:in `build_configs'
# ./vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.3.1/lib/active_record/database_configurations.rb:19:in `initialize'
# ./vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.3.1/lib/active_record/core.rb:64:in `new'
# ./vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.3.1/lib/active_record/core.rb:64:in `configurations='
# ./vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.3.1/lib/active_record/core.rb:66:in `block in <module:Core>'
# ./vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/concern.rb:136:in `class_eval'
# ./vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/concern.rb:136:in `append_features'
# ./vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.3.1/lib/active_record/base.rb:282:in `include'
# ./vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.3.1/lib/active_record/base.rb:282:in `<class:Base>'
# ./vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.3.1/lib/active_record/base.rb:265:in `<module:ActiveRecord>'
# ./vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.3.1/lib/active_record/base.rb:15:in `<top (required)>'
# ./vendor/bundle/ruby/2.7.0/gems/database_cleaner-active_record-2.0.0/lib/database_cleaner/active_record/truncation.rb:2:in `require'
# ./vendor/bundle/ruby/2.7.0/gems/database_cleaner-active_record-2.0.0/lib/database_cleaner/active_record/truncation.rb:2:in `<top (required)>'
# ./vendor/bundle/ruby/2.7.0/gems/database_cleaner-active_record-2.0.0/lib/database_cleaner/active_record.rb:4:in `require'
# ./vendor/bundle/ruby/2.7.0/gems/database_cleaner-active_record-2.0.0/lib/database_cleaner/active_record.rb:4:in `<top (required)>'
# ./vendor/bundle/ruby/2.7.0/gems/database_cleaner-2.0.1/lib/database_cleaner.rb:1:in `require'
# ./vendor/bundle/ruby/2.7.0/gems/database_cleaner-2.0.1/lib/database_cleaner.rb:1:in `<top (required)>'
# ./spec/rails_helper.rb:3:in `require'
# ./spec/rails_helper.rb:3:in `<top (required)>'
# ./spec/auth/authenticate_user_spec.rb:1:in `require'
# ./spec/auth/authenticate_user_spec.rb:1:in `<top (required)>'
Rails V: 6.1.3.1 - test
ruby '2.7.2'
Gemfile:
group :development, :test do
gem 'database_cleaner'
end
Gemfile.lock
database_cleaner (2.0.1)
database_cleaner-active_record (~> 2.0.0)
database_cleaner-active_record (2.0.0)
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
On my internet research I found this:
https://blog.code-fabrik.ch/2021/03/31/sinatra-databaseconfiguration-url.html
- 主要语言
- Ruby
- 星标
- 3k
- 派生
- 484
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
DatabaseCleaner/database_cleaner 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 67/100
-
难度 4/5 3-5 天 新手友好度 25/100
-
难度 3/5 1-2 天 新手友好度 45/100
-
难度 4/5 3-5 天 新手友好度 35/100
DatabaseCleaner/database_cleaner#717 · 5 条评论 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 25/100
DatabaseCleaner/database_cleaner#716 · 2 条评论 ·
查看 DatabaseCleaner/database_cleaner 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
Homebrew/homebrew-core#317477 · 2 条评论 ·
维护者通常 1 天内回复
-
area/web interface
难度 2/5 1-3 小时 新手友好度 62/100
mastodon/mastodon#41009 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
yegor256/ellipsized#131 ·
-
难度 2/5 1-3 小时 新手友好度 85/100