@@ -23,12 +23,18 @@ def mock_request(query_parameters = {}, original_url = URI)
23
23
context = Minitest ::Mock . new
24
24
context . expect ( :request_url , original_url )
25
25
context . expect ( :query_parameters , query_parameters )
26
- @options = { }
27
- @options [ :serialization_context ] = context
26
+ @serializer_options = {
27
+ serialization_context : context ,
28
+ adapter : :json_api
29
+ }
28
30
end
29
31
30
32
def load_adapter ( paginated_collection , options = { } )
31
- options = options . merge ( adapter : :json_api )
33
+ if options
34
+ options . merge! ( @serializer_options )
35
+ else
36
+ options = @serializer_options
37
+ end
32
38
ActiveModel ::SerializableResource . new ( paginated_collection , options )
33
39
end
34
40
@@ -84,22 +90,22 @@ def test_pagination_links_using_kaminari
84
90
adapter = load_adapter ( using_kaminari )
85
91
86
92
mock_request
87
- assert_equal expected_response_with_pagination_links , adapter . serializable_hash ( @options )
93
+ assert_equal expected_response_with_pagination_links , adapter . serializable_hash
88
94
end
89
95
90
96
def test_pagination_links_using_will_paginate
91
97
adapter = load_adapter ( using_will_paginate )
92
98
93
99
mock_request
94
- assert_equal expected_response_with_pagination_links , adapter . serializable_hash ( @options )
100
+ assert_equal expected_response_with_pagination_links , adapter . serializable_hash
95
101
end
96
102
97
103
def test_pagination_links_with_additional_params
98
104
adapter = load_adapter ( using_will_paginate )
99
105
100
106
mock_request ( { test : 'test' } )
101
107
assert_equal expected_response_with_pagination_links_and_additional_params ,
102
- adapter . serializable_hash ( @options )
108
+ adapter . serializable_hash
103
109
end
104
110
105
111
def test_not_showing_pagination_links
0 commit comments