Merge pull request #51068 from Edouard-chin/ec-dont-load-test-from-fixture

Don't load `*_test.rb` file from the "fixtures" folder:
This commit is contained in:
Rafael Mendonça França 2024-02-13 18:09:24 -05:00 committed by GitHub
commit 2e4a2b7eea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,7 @@
* `bin/rails test` will no longer load files named `*_test.rb` if they are located in the `fixtures` folder.
*Edouard Chin*
* Ensure logger tags configured with `config.log_tags` are still active in `request.action_dispatch` handlers * Ensure logger tags configured with `config.log_tags` are still active in `request.action_dispatch` handlers
*KJ Tsanaktsidis* *KJ Tsanaktsidis*

View File

@ -87,7 +87,7 @@ module Rails
end end
def default_test_exclude_glob def default_test_exclude_glob
ENV["DEFAULT_TEST_EXCLUDE"] || "test/{system,dummy}/**/*_test.rb" ENV["DEFAULT_TEST_EXCLUDE"] || "test/{system,dummy,fixtures}/**/*_test.rb"
end end
def regexp_filter?(arg) def regexp_filter?(arg)

View File

@ -1223,6 +1223,12 @@ module ApplicationTests
assert_match "1 runs, 1 assertions, 0 failures, 0 errors, 0 skips", output assert_match "1 runs, 1 assertions, 0 failures, 0 errors, 0 skips", output
end end
def test_run_does_not_load_file_from_the_fixture_folder
create_test_file "fixtures", "smoke_foo"
assert_match "0 runs, 0 assertions, 0 failures, 0 errors, 0 skips", run_test_command("")
end
def test_can_exclude_files_from_being_tested_via_default_rails_command_by_setting_DEFAULT_TEST_EXCLUDE_env_var def test_can_exclude_files_from_being_tested_via_default_rails_command_by_setting_DEFAULT_TEST_EXCLUDE_env_var
create_test_file "smoke", "smoke_foo" create_test_file "smoke", "smoke_foo"