Skip to content

Commit a5554e0

Browse files
committed
Use a different controller in different tests
A number of test were defining and using the same controller MyController = Class.new(ActionController::Base) which was causing some state to leak across tests.
1 parent 0f0ef2b commit a5554e0

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

test/action_controller/adapter_selector_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module ActionController
44
module Serialization
55
class AdapterSelectorTest < ActionController::TestCase
6-
class MyController < ActionController::Base
6+
class AdapterSelectorTestController < ActionController::Base
77
def render_using_default_adapter
88
@profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
99
render json: @profile
@@ -20,7 +20,7 @@ def render_skipping_adapter
2020
end
2121
end
2222

23-
tests MyController
23+
tests AdapterSelectorTestController
2424

2525
def test_render_using_default_adapter
2626
get :render_using_default_adapter

test/action_controller/explicit_serializer_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module ActionController
44
module Serialization
55
class ExplicitSerializerTest < ActionController::TestCase
6-
class MyController < ActionController::Base
6+
class ExplicitSerializerTestController < ActionController::Base
77
def render_using_explicit_serializer
88
@profile = Profile.new(name: 'Name 1',
99
description: 'Description 1',
@@ -65,7 +65,7 @@ def render_using_explicit_each_serializer
6565
end
6666
end
6767

68-
tests MyController
68+
tests ExplicitSerializerTestController
6969

7070
def test_render_using_explicit_serializer
7171
get :render_using_explicit_serializer

test/action_controller/json_api_linked_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module ActionController
44
module Serialization
55
class JsonApiLinkedTest < ActionController::TestCase
6-
class MyController < ActionController::Base
6+
class JsonApiLinkedTestController < ActionController::Base
77
def setup_post
88
ActionController::Base.cache_store.clear
99
@role1 = Role.new(id: 1, name: 'admin')
@@ -78,7 +78,7 @@ def render_collection_with_include
7878
end
7979
end
8080

81-
tests MyController
81+
tests JsonApiLinkedTestController
8282

8383
def test_render_resource_without_include
8484
get :render_resource_without_include

test/action_controller/rescue_from_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module ActionController
44
module Serialization
55
class RescueFromTest < ActionController::TestCase
6-
class MyController < ActionController::Base
6+
class RescueFromTestController < ActionController::Base
77
rescue_from Exception, with: :handle_error
88

99
def render_using_raise_error_serializer
@@ -16,7 +16,7 @@ def handle_error(exception)
1616
end
1717
end
1818

19-
tests MyController
19+
tests RescueFromTestController
2020

2121
def test_rescue_from
2222
get :render_using_raise_error_serializer

test/action_controller/serialization_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module ActionController
44
module Serialization
55
class ImplicitSerializerTest < ActionController::TestCase
6-
class MyController < ActionController::Base
6+
class ImplicitSerializationTestController < ActionController::Base
77
def render_using_implicit_serializer
88
@profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
99
render json: @profile
@@ -152,7 +152,7 @@ def with_adapter(adapter)
152152
end
153153
end
154154

155-
tests MyController
155+
tests ImplicitSerializationTestController
156156

157157
# We just have Null for now, this will change
158158
def test_render_using_implicit_serializer

0 commit comments

Comments
 (0)