-
Notifications
You must be signed in to change notification settings - Fork 64
Expose deserialization reverse mapping in controllers #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose deserialization reverse mapping in controllers #29
Conversation
spec/action_controller_spec.rb
Outdated
it 'should fetch the mapping created during deserialization' do | ||
reverse_mapping = {id: "/data/id", type: "/data/type"} | ||
allow(controller).to receive(:request) do | ||
OpenStruct.new(env: {'jsonapi_deserializable.reverse_mapping' => reverse_mapping}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space inside { missing.
Line is too long. [90/80]
Space inside } missing.
spec/action_controller_spec.rb
Outdated
|
||
context 'source pointers' do | ||
it 'should fetch the mapping created during deserialization' do | ||
reverse_mapping = {id: "/data/id", type: "/data/type"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space inside { missing.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
Space inside } missing.
spec/action_controller_spec.rb
Outdated
|
||
RSpec.describe JSONAPI::Rails::ActionController do | ||
class TestController < ActionController::Base | ||
deserializable_resource "things" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
@@ -0,0 +1,19 @@ | |||
require 'rails_helper' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing magic comment # frozen_string_literal: true.
spec/action_controller_spec.rb
Outdated
it 'should fetch the mapping created during deserialization' do | ||
reverse_mapping = {id: "/data/id", type: "/data/type"} | ||
allow(controller).to receive(:request) do | ||
OpenStruct.new(env: {'jsonapi_deserializable.reverse_mapping' => reverse_mapping}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space inside { missing.
Line is too long. [90/80]
Space inside } missing.
spec/action_controller_spec.rb
Outdated
|
||
context 'source pointers' do | ||
it 'should fetch the mapping created during deserialization' do | ||
reverse_mapping = {id: "/data/id", type: "/data/type"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space inside { missing.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
Space inside } missing.
spec/action_controller_spec.rb
Outdated
|
||
RSpec.describe JSONAPI::Rails::ActionController do | ||
class TestController < ActionController::Base | ||
deserializable_resource "things" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
@@ -0,0 +1,19 @@ | |||
require 'rails_helper' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing magic comment # frozen_string_literal: true.
Thanks for this @mdeutsch, I'll rebase it, clean it up, and merge 👍. |
e5fc28c
to
c7a939c
Compare
spec/action_controller_spec.rb
Outdated
let(:controller) { TestController.new } | ||
|
||
it 'should fetch the mapping created during deserialization' do | ||
pointers = { id: "/data/id", type: "/data/type" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
9dd5b19
to
f6a8287
Compare
spec/action_controller_spec.rb
Outdated
require 'rails_helper' | ||
|
||
RSpec.describe ActionController::Base do | ||
it 'should expose the deserialization mapping via the jsonapi_pointers method' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [83/80]
f6a8287
to
2c91b91
Compare
* upstream/master: Improve specs (jsonapi-rb#33) Expose deserialization reverse mapping in controllers (jsonapi-rb#29) Update jsonapi-rb to v0.2.1. (jsonapi-rb#32) Add dummy app temp files to .gitignore (jsonapi-rb#30) Deal with jsonapi-serializable no longer calling to_json (jsonapi-rb#26)
Adds a
jsonapi_pointers
instance method in the controller to access the json pointers generated during deserialization. See #27.