@@ -35,12 +35,12 @@ def test_reflection_block_with_link_mutates_the_reflection_links
35
35
36
36
# Get Reflection
37
37
reflection = serializer_class . _reflections . fetch ( :blog )
38
- assert_equal @empty_links , reflection . instance_variable_get ( :@_links )
38
+ assert_equal @empty_links , reflection . options . fetch ( :links )
39
39
40
40
# Build Association
41
41
association = reflection . build_association ( serializer_instance , @instance_options )
42
42
assert_equal @expected_links , association . links
43
- assert_equal @expected_links , reflection . instance_variable_get ( :@_links )
43
+ assert_equal @expected_links , reflection . options . fetch ( :links )
44
44
end
45
45
46
46
def test_reflection_block_with_link_block_mutates_the_reflection_links
@@ -55,7 +55,7 @@ def test_reflection_block_with_link_block_mutates_the_reflection_links
55
55
56
56
# Get Reflection
57
57
reflection = serializer_class . _reflections . fetch ( :blog )
58
- assert_equal @empty_links , reflection . instance_variable_get ( :@_links )
58
+ assert_equal @empty_links , reflection . options . fetch ( :links )
59
59
60
60
# Build Association
61
61
association = reflection . build_association ( serializer_instance , @instance_options )
@@ -65,7 +65,7 @@ def test_reflection_block_with_link_block_mutates_the_reflection_links
65
65
66
66
# Assert after instance_eval link
67
67
assert_equal @expected_links . fetch ( :self ) , reflection . instance_eval ( &link )
68
- assert_respond_to reflection . instance_variable_get ( :@_links ) . fetch ( :self ) , :call
68
+ assert_respond_to reflection . options . fetch ( :links ) . fetch ( :self ) , :call
69
69
end
70
70
71
71
def test_reflection_block_with_meta_mutates_the_reflection_meta
@@ -78,12 +78,12 @@ def test_reflection_block_with_meta_mutates_the_reflection_meta
78
78
79
79
# Get Reflection
80
80
reflection = serializer_class . _reflections . fetch ( :blog )
81
- assert_nil reflection . instance_variable_get ( :@_meta )
81
+ assert_nil reflection . options . fetch ( :meta )
82
82
83
83
# Build Association
84
84
association = reflection . build_association ( serializer_instance , @instance_options )
85
85
assert_equal @expected_meta , association . meta
86
- assert_equal @expected_meta , reflection . instance_variable_get ( :@_meta )
86
+ assert_equal @expected_meta , reflection . options . fetch ( :meta )
87
87
end
88
88
89
89
def test_reflection_block_with_meta_block_mutates_the_reflection_meta
@@ -98,17 +98,17 @@ def test_reflection_block_with_meta_block_mutates_the_reflection_meta
98
98
99
99
# Get Reflection
100
100
reflection = serializer_class . _reflections . fetch ( :blog )
101
- assert_nil reflection . instance_variable_get ( :@_meta )
101
+ assert_nil reflection . options . fetch ( :meta )
102
102
103
103
# Build Association
104
104
association = reflection . build_association ( serializer_instance , @instance_options )
105
105
# Assert before instance_eval meta
106
106
assert_respond_to association . meta , :call
107
- assert_respond_to reflection . instance_variable_get ( :@_meta ) , :call
107
+ assert_respond_to reflection . options . fetch ( :meta ) , :call
108
108
109
109
# Assert after instance_eval meta
110
110
assert_equal @expected_meta , reflection . instance_eval ( &association . meta )
111
- assert_respond_to reflection . instance_variable_get ( :@_meta ) , :call
111
+ assert_respond_to reflection . options . fetch ( :meta ) , :call
112
112
assert_respond_to association . meta , :call
113
113
end
114
114
@@ -125,23 +125,23 @@ def test_reflection_block_with_meta_in_link_block_mutates_the_reflection_meta
125
125
126
126
# Get Reflection
127
127
reflection = serializer_class . _reflections . fetch ( :blog )
128
- assert_nil reflection . instance_variable_get ( :@_meta )
129
- assert_equal @empty_links , reflection . instance_variable_get ( :@_links )
128
+ assert_nil reflection . options . fetch ( :meta )
129
+ assert_equal @empty_links , reflection . options . fetch ( :links )
130
130
131
131
# Build Association
132
132
association = reflection . build_association ( serializer_instance , @instance_options )
133
133
# Assert before instance_eval link meta
134
134
assert_nil association . meta
135
- assert_nil reflection . instance_variable_get ( :@_meta )
135
+ assert_nil reflection . options . fetch ( :meta )
136
136
137
137
link = association . links . fetch ( :self )
138
138
assert_respond_to link , :call
139
- assert_respond_to reflection . instance_variable_get ( :@_links ) . fetch ( :self ) , :call
140
- assert_nil reflection . instance_variable_get ( :@_meta )
139
+ assert_respond_to reflection . options . fetch ( :links ) . fetch ( :self ) , :call
140
+ assert_nil reflection . options . fetch ( :meta )
141
141
142
142
# Assert after instance_eval link
143
143
assert_equal 'no_uri_validation' , reflection . instance_eval ( &link )
144
- assert_equal @expected_meta , reflection . instance_variable_get ( :@_meta )
144
+ assert_equal @expected_meta , reflection . options . fetch ( :meta )
145
145
assert_nil association . meta
146
146
end
147
147
@@ -161,28 +161,28 @@ def test_reflection_block_with_meta_block_in_link_block_mutates_the_reflection_m
161
161
162
162
# Get Reflection
163
163
reflection = serializer_class . _reflections . fetch ( :blog )
164
- assert_nil reflection . instance_variable_get ( :@_meta )
164
+ assert_nil reflection . options . fetch ( :meta )
165
165
166
166
# Build Association
167
167
association = reflection . build_association ( serializer_instance , @instance_options )
168
168
assert_nil association . meta
169
- assert_nil reflection . instance_variable_get ( :@_meta )
169
+ assert_nil reflection . options . fetch ( :meta )
170
170
171
171
# Assert before instance_eval link
172
172
link = association . links . fetch ( :self )
173
- assert_nil reflection . instance_variable_get ( :@_meta )
173
+ assert_nil reflection . options . fetch ( :meta )
174
174
assert_respond_to link , :call
175
175
assert_respond_to association . links . fetch ( :self ) , :call
176
176
177
177
# Assert after instance_eval link
178
178
assert_equal 'no_uri_validation' , reflection . instance_eval ( &link )
179
179
assert_respond_to association . links . fetch ( :self ) , :call
180
180
# Assert before instance_eval link meta
181
- assert_respond_to reflection . instance_variable_get ( :@_meta ) , :call
181
+ assert_respond_to reflection . options . fetch ( :meta ) , :call
182
182
assert_nil association . meta
183
183
184
184
# Assert after instance_eval link meta
185
- assert_equal @expected_meta , reflection . instance_eval ( &reflection . instance_variable_get ( :@_meta ) )
185
+ assert_equal @expected_meta , reflection . instance_eval ( &reflection . options . fetch ( :meta ) )
186
186
assert_nil association . meta
187
187
end
188
188
# rubocop:enable Metrics/AbcSize
@@ -199,7 +199,7 @@ def test_no_href_in_vanilla_reflection
199
199
200
200
# Get Reflection
201
201
reflection = serializer_class . _reflections . fetch ( :blog )
202
- assert_equal @empty_links , reflection . instance_variable_get ( :@_links )
202
+ assert_equal @empty_links , reflection . options . fetch ( :links )
203
203
204
204
# Build Association
205
205
association = reflection . build_association ( serializer_instance , @instance_options )
0 commit comments