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