File tree 1 file changed +11
-12
lines changed
1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change 1
1
require 'rails_helper'
2
2
3
3
RSpec . describe JSONAPI ::Rails ::ActionController do
4
- class TestController < ActionController ::Base
5
- deserializable_resource "things"
6
- end
7
-
8
- let ( :controller ) { TestController . new }
4
+ let ( :controller ) { ActionController ::Base . new }
9
5
10
- context 'source pointers' do
11
- it 'should fetch the mapping created during deserialization' do
12
- reverse_mapping = { id : "/data/id" , type : "/data/type" }
13
- allow ( controller ) . to receive ( :request ) do
14
- OpenStruct . new ( env : { 'jsonapi_deserializable.reverse_mapping' => reverse_mapping } )
15
- end
16
- expect ( controller . send ( :jsonapi_pointers ) ) . to equal reverse_mapping
6
+ it 'should fetch the mapping created during deserialization' do
7
+ pointers = { id : '/data/id' , type : '/data/type' }
8
+ allow ( controller ) . to receive ( :request ) do
9
+ OpenStruct . new (
10
+ env : {
11
+ JSONAPI ::Rails ::ActionController ::JSONAPI_POINTERS_KEY => pointers
12
+ }
13
+ )
17
14
end
15
+
16
+ expect ( controller . send ( :jsonapi_pointers ) ) . to equal pointers
18
17
end
19
18
end
You can’t perform that action at this time.
0 commit comments