|
172 | 172 | context 'authorized for first relationship' do
|
173 | 173 | before { allow_operation('include_has_one_resource', source_record: an_instance_of(Article), related_record: an_instance_of(User), authorizer: chained_authorizer) }
|
174 | 174 |
|
175 |
| - context 'unauthorized for second relationship', pending: 'Compatibility with JR 0.10' do |
176 |
| - before { disallow_operation('include_has_many_resource', source_record: an_instance_of(User), record_class: Comment, authorizer: chained_authorizer) } |
| 175 | + context 'unauthorized for second relationship' do |
| 176 | + # FIXME: Why is include_has_many_resource called with `source_record` being an instance of Article and not User? |
| 177 | + # We're fetching comments made by some specific User here, so the `source_record` should be an instance of User, right? |
| 178 | + before { disallow_operation('include_has_many_resource', source_record: an_instance_of(Article), record_class: Comment, authorizer: chained_authorizer) } |
| 179 | + # before { disallow_operation('include_has_many_resource', source_record: an_instance_of(User), record_class: Comment, authorizer: chained_authorizer) } |
177 | 180 |
|
178 | 181 | it { is_expected.to be_forbidden }
|
179 | 182 | end
|
180 | 183 |
|
181 |
| - context 'authorized for second relationship', pending: 'Compatibility with JR 0.10' do |
182 |
| - before { allow_operation('include_has_many_resource', source_record: an_instance_of(User), record_class: Comment, authorizer: chained_authorizer) } |
| 184 | + context 'authorized for second relationship' do |
| 185 | + # FIXME: Why is include_has_many_resource called with `source_record` being an instance of Article and not User? |
| 186 | + # We're fetching comments made by some specific User here, so the `source_record` should be an instance of User, right? |
| 187 | + before { allow_operation('include_has_many_resource', source_record: an_instance_of(Article), record_class: Comment, authorizer: chained_authorizer) } |
| 188 | + # before { allow_operation('include_has_many_resource', source_record: an_instance_of(User), record_class: Comment, authorizer: chained_authorizer) } |
183 | 189 |
|
184 | 190 | it { is_expected.to be_successful }
|
185 | 191 |
|
|
202 | 208 | end
|
203 | 209 |
|
204 | 210 | describe 'a deep relationship with empty relations' do
|
205 |
| - context 'first level has_one is nil', pending: 'Compatibility with JR 0.10' do |
| 211 | + context 'first level has_one is nil' do |
| 212 | + # FIXME: Why is the `include_has_many_resource` even being called here? |
| 213 | + # There should not be any comments assigned via `non_existing_article -> comments` query. |
| 214 | + # Article.non_existing_article `has_one` relation returns `none` so we shouldn't get any Comment records, either |
| 215 | + before { allow_operation('include_has_many_resource', source_record: an_instance_of(Article), record_class: Comment, authorizer: chained_authorizer) } |
206 | 216 | let(:include_query) { 'non-existing-article.comments' }
|
207 | 217 |
|
208 | 218 | it { is_expected.to be_successful }
|
|
217 | 227 | it { is_expected.to be_forbidden }
|
218 | 228 | end
|
219 | 229 |
|
220 |
| - context 'authorized for first relationship', pending: 'Compatibility with JR 0.10' do |
| 230 | + context 'authorized for first relationship' do |
| 231 | + # FIXME: Why is the `include_has_many_resource` being called here with `record_class: Comment`? |
| 232 | + # There should not be any comments assigned via `empty_articles -> comments` query. |
| 233 | + # Article.empty_articles `has_many` relation returns `none` so we shouldn't get any Comment records, either |
| 234 | + before { allow_operation('include_has_many_resource', source_record: an_instance_of(Article), record_class: Comment, authorizer: chained_authorizer) } |
221 | 235 | before { allow_operation('include_has_many_resource', source_record: an_instance_of(Article), record_class: Article, authorizer: chained_authorizer) }
|
222 | 236 |
|
223 | 237 | it { is_expected.to be_successful }
|
|
284 | 298 | context 'authorized for first relationship' do
|
285 | 299 | before { allow_operation('include_has_one_resource', source_record: an_instance_of(Article), related_record: an_instance_of(User), authorizer: chained_authorizer) }
|
286 | 300 |
|
287 |
| - context 'authorized for second relationship', pending: 'Compatibility with JR 0.10' do |
288 |
| - before { allow_operation('include_has_many_resource', source_record: an_instance_of(User), record_class: Comment, authorizer: chained_authorizer) } |
| 301 | + context 'authorized for second relationship' do |
| 302 | + # FIXME: Why is include_has_many_resource called with `source_record` being an instance of Article and not User? |
| 303 | + # We're fetching comments made by some specific User here, so the `source_record` should be an instance of User, right? |
| 304 | + before { allow_operation('include_has_many_resource', source_record: an_instance_of(Article), record_class: Comment, authorizer: chained_authorizer) } |
| 305 | + # before { allow_operation('include_has_many_resource', source_record: an_instance_of(User), record_class: Comment, authorizer: chained_authorizer) } |
289 | 306 |
|
290 | 307 | it { is_expected.to be_successful }
|
291 | 308 |
|
|
0 commit comments