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

Introduce ApplicationTestCase #28243

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion actionmailer/lib/action_mailer/test_case.rb
Expand Up @@ -10,7 +10,7 @@ def initialize(name)
end
end

class TestCase < ActiveSupport::TestCase
class TestCase < ApplicationTestCase
module ClearTestDeliveries
extend ActiveSupport::Concern

Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/test_case.rb
Expand Up @@ -322,7 +322,7 @@ def load!
# If you're using named routes, they can be easily tested using the original named routes' methods straight in the test case.
#
# assert_redirected_to page_url(title: 'foo')
class TestCase < ActiveSupport::TestCase
class TestCase < ApplicationTestCase
module Behavior
extend ActiveSupport::Concern
include ActionDispatch::TestProcess
Expand Down
2 changes: 1 addition & 1 deletion actionview/lib/action_view/test_case.rb
Expand Up @@ -7,7 +7,7 @@

module ActionView
# = Action View Test Case
class TestCase < ActiveSupport::TestCase
class TestCase < ApplicationTestCase
class TestController < ActionController::Base
include ActionDispatch::TestProcess

Expand Down
2 changes: 1 addition & 1 deletion activejob/lib/active_job/test_case.rb
@@ -1,7 +1,7 @@
require "active_support/test_case"

module ActiveJob
class TestCase < ActiveSupport::TestCase
class TestCase < ApplicationTestCase
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the idea of ApplicationTestCase applies to Rails projects, not the Rails test suite itself.

include ActiveJob::TestHelper

ActiveSupport.run_load_hooks(:active_job_test_case, self)
Expand Down
2 changes: 1 addition & 1 deletion activerecord/test/cases/test_case.rb
Expand Up @@ -10,7 +10,7 @@ module ActiveRecord
# = Active Record Test Case
#
# Defines some test assertions to test against SQL queries.
class TestCase < ActiveSupport::TestCase #:nodoc:
class TestCase < ApplicationTestCase #:nodoc:
include ActiveSupport::Testing::MethodCallAssertions
include ActiveSupport::Testing::Stream
include ActiveRecord::TestFixtures
Expand Down
2 changes: 1 addition & 1 deletion activesupport/test/notifications_test.rb
Expand Up @@ -2,7 +2,7 @@
require "active_support/core_ext/module/delegation"

module Notifications
class TestCase < ActiveSupport::TestCase
class TestCase < ApplicationTestCase
def setup
@old_notifier = ActiveSupport::Notifications.notifier
@notifier = ActiveSupport::Notifications::Fanout.new
Expand Down
2 changes: 1 addition & 1 deletion railties/lib/rails/generators/test_case.rb
Expand Up @@ -25,7 +25,7 @@ module Generators
# destination File.expand_path("../tmp", File.dirname(__FILE__))
# setup :prepare_destination
# end
class TestCase < ActiveSupport::TestCase
class TestCase < ApplicationTestCase
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also generate ApplicationTestCase for new Rails apps

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But ApplicationTestCase make not sense since the application may have view tests, controller tests, integrations tests, model tests. If we add new test case superclasses we would need ApplicationViewTestCase, ApplicationModelTestCase. I think this is a problem to the application solve. If they are doing things to ActiveSupport::TestCase just because it is shared across all they test cases probably they want to add only in the places the thing is needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It still means that Rails must provide the structure for that in generators, yes?

include Rails::Generators::Testing::Behaviour
include Rails::Generators::Testing::SetupAndTeardown
include Rails::Generators::Testing::Assertions
Expand Down