44class IncludeDirectivesTest < ActiveSupport ::TestCase
55
66 def test_one_level_one_include
7- directives = JSONAPI ::IncludeDirectives . new ( PersonResource , [ 'posts' ] ) . include_directives_hash
7+ directives = JSONAPI ::IncludeDirectives . new ( PersonResource , [ 'posts' ] ) . instance_variable_get ( :@ include_directives_hash)
88
99 assert_hash_equals (
1010 {
@@ -18,7 +18,7 @@ def test_one_level_one_include
1818 end
1919
2020 def test_one_level_multiple_includes
21- directives = JSONAPI ::IncludeDirectives . new ( PersonResource , [ 'posts' , 'comments' , 'expense_entries' ] ) . include_directives_hash
21+ directives = JSONAPI ::IncludeDirectives . new ( PersonResource , [ 'posts' , 'comments' , 'expense_entries' ] ) . instance_variable_get ( :@ include_directives_hash)
2222
2323 assert_hash_equals (
2424 {
@@ -38,7 +38,7 @@ def test_one_level_multiple_includes
3838 end
3939
4040 def test_multiple_level_multiple_includes
41- directives = JSONAPI ::IncludeDirectives . new ( PersonResource , [ 'posts' , 'posts.comments' , 'comments' , 'expense_entries' ] ) . include_directives_hash
41+ directives = JSONAPI ::IncludeDirectives . new ( PersonResource , [ 'posts' , 'posts.comments' , 'comments' , 'expense_entries' ] ) . instance_variable_get ( :@ include_directives_hash)
4242
4343 assert_hash_equals (
4444 {
@@ -63,7 +63,7 @@ def test_multiple_level_multiple_includes
6363
6464
6565 def test_two_levels_include_full_path
66- directives = JSONAPI ::IncludeDirectives . new ( PersonResource , [ 'posts.comments' ] ) . include_directives_hash
66+ directives = JSONAPI ::IncludeDirectives . new ( PersonResource , [ 'posts.comments' ] ) . instance_variable_get ( :@ include_directives_hash)
6767
6868 assert_hash_equals (
6969 {
@@ -81,7 +81,7 @@ def test_two_levels_include_full_path
8181 end
8282
8383 def test_two_levels_include_full_path_redundant
84- directives = JSONAPI ::IncludeDirectives . new ( PersonResource , [ 'posts' , 'posts.comments' ] ) . include_directives_hash
84+ directives = JSONAPI ::IncludeDirectives . new ( PersonResource , [ 'posts' , 'posts.comments' ] ) . instance_variable_get ( :@ include_directives_hash)
8585
8686 assert_hash_equals (
8787 {
@@ -99,7 +99,7 @@ def test_two_levels_include_full_path_redundant
9999 end
100100
101101 def test_three_levels_include_full
102- directives = JSONAPI ::IncludeDirectives . new ( PersonResource , [ 'posts.comments.tags' ] ) . include_directives_hash
102+ directives = JSONAPI ::IncludeDirectives . new ( PersonResource , [ 'posts.comments.tags' ] ) . instance_variable_get ( :@ include_directives_hash)
103103
104104 assert_hash_equals (
105105 {
@@ -127,19 +127,19 @@ def test_three_levels_include_full
127127 #
128128 def test_invalid_includes_1
129129 assert_raises JSONAPI ::Exceptions ::InvalidInclude do
130- JSONAPI ::IncludeDirectives . new ( PersonResource , [ '../../../../' ] ) . include_directives_hash
130+ JSONAPI ::IncludeDirectives . new ( PersonResource , [ '../../../../' ] ) . instance_variable_get ( :@ include_directives_hash)
131131 end
132132 end
133133
134134 def test_invalid_includes_2
135135 assert_raises JSONAPI ::Exceptions ::InvalidInclude do
136- JSONAPI ::IncludeDirectives . new ( PersonResource , [ 'posts./sdaa./........' ] ) . include_directives_hash
136+ JSONAPI ::IncludeDirectives . new ( PersonResource , [ 'posts./sdaa./........' ] ) . instance_variable_get ( :@ include_directives_hash)
137137 end
138138 end
139139
140140 def test_invalid_includes_3
141141 assert_raises JSONAPI ::Exceptions ::InvalidInclude do
142- JSONAPI ::IncludeDirectives . new ( PersonResource , [ 'invalid../../../../' ] ) . include_directives_hash
142+ JSONAPI ::IncludeDirectives . new ( PersonResource , [ 'invalid../../../../' ] ) . instance_variable_get ( :@ include_directives_hash)
143143 end
144144 end
145145end
0 commit comments