4
4
class RailtieTest < ActiveSupport ::TestCase
5
5
include ActiveSupport ::Testing ::Isolation
6
6
7
- class WithRails < RailtieTest
7
+ class WithRailsRequiredFirst < RailtieTest
8
8
setup do
9
9
require 'rails'
10
10
require 'active_model_serializers'
11
- make_basic_app
11
+ make_basic_app do |app |
12
+ app . config . action_controller . perform_caching = true
13
+ end
12
14
end
13
15
14
16
test 'mixes ActionController::Serialization into ActionController::Base' do
@@ -32,17 +34,17 @@ class WithRails < RailtieTest
32
34
33
35
test 'it is configured for caching' do
34
36
assert_equal ActionController ::Base . cache_store , ActiveModelSerializers . config . cache_store
35
- expected = Rails . configuration . action_controller . perform_caching
36
- actual = ActiveModelSerializers . config . perform_caching
37
- assert_nil expected
38
- assert_nil actual
37
+ assert_equal true , Rails . configuration . action_controller . perform_caching
38
+ assert_equal true , ActiveModelSerializers . config . perform_caching
39
39
end
40
40
end
41
41
42
- class WithoutRails < RailtieTest
42
+ class WithoutRailsRequiredFirst < RailtieTest
43
43
setup do
44
44
require 'active_model_serializers'
45
- make_basic_app
45
+ make_basic_app do |app |
46
+ app . config . action_controller . perform_caching = true
47
+ end
46
48
end
47
49
48
50
test 'does not mix ActionController::Serialization into ActionController::Base' do
@@ -59,8 +61,8 @@ class WithoutRails < RailtieTest
59
61
test 'it is not configured for caching' do
60
62
refute_nil ActionController ::Base . cache_store
61
63
assert_nil ActiveModelSerializers . config . cache_store
62
- refute Rails . configuration . action_controller . perform_caching
63
- refute ActiveModelSerializers . config . perform_caching
64
+ assert_equal true , Rails . configuration . action_controller . perform_caching
65
+ assert_nil ActiveModelSerializers . config . perform_caching
64
66
end
65
67
end
66
68
end
0 commit comments