Skip to content

Commit f6a8287

Browse files
committed
Clean up spec.
1 parent 5dbf28d commit f6a8287

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

spec/action_controller_spec.rb

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
require 'rails_helper'
22

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' }
96

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+
)
1713
end
14+
15+
expect(subject.send(:jsonapi_pointers)).to equal pointers
1816
end
1917
end

0 commit comments

Comments
 (0)