Skip to content

Commit 9dd5b19

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

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

spec/action_controller_spec.rb

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

33
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 }
95

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+
)
1714
end
15+
16+
expect(controller.send(:jsonapi_pointers)).to equal pointers
1817
end
1918
end

0 commit comments

Comments
 (0)