-
Notifications
You must be signed in to change notification settings - Fork 30
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
Avoid loading Rails or ActiveSupport in tests #510
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# typed: true | ||
# frozen_string_literal: true | ||
|
||
# Configure Rails Environment | ||
ENV["RAILS_ENV"] = "test" | ||
|
||
require "test_helper" | ||
|
||
require_relative "../test/dummy/config/environment" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is the key culprit here. I don't even think we need to switch fully to just Minitest. As long as we require only the parts of Active Support related to testing, we can continue with the same setup. But we can't load the dummy app for every test because that will load everything and get us into trouble. |
||
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)] | ||
ActiveRecord::Migrator.migrations_paths << File.expand_path("../db/migrate", __dir__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you test if adding a
present?
in the add-on code breaks when runningbundle exec rake
?I think because
test:server
is last, then the related test helper only gets required at the end, but I'm not 100% sure.