Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

uninitialized constant ActiveRecord::DatabaseConfigurations::ConnectionUrlResolver::URI

未关闭
#686 2 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
42/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
rails, ruby
领域
testing

调研方向

使用 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 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

DatabaseCleaner/database_cleaner 的其他 Issue

查看 DatabaseCleaner/database_cleaner 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。