Skip to content

Commit

Permalink
Update top-level link with PR #1247
Browse files Browse the repository at this point in the history
update according rubocop rules
  • Loading branch information
leandrocp committed Feb 3, 2016
1 parent 1844c16 commit 37e4f1c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 133 deletions.
25 changes: 0 additions & 25 deletions lib/active_model/serializer/adapter/json_api/links.rb

This file was deleted.

13 changes: 6 additions & 7 deletions test/action_controller/serialization_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@ def render_array_using_implicit_serializer_and_meta

def render_array_using_implicit_serializer_and_links
with_adapter ActiveModel::Serializer::Adapter::JsonApi do

@profiles = [
Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
Profile.new(name: 'Name 1', description: 'Description 1', comments: 'Comments 1')
]

render json: @profiles, links: { self: "http://example.com/api/profiles/1" }
render json: @profiles, links: { self: 'http://example.com/api/profiles/1' }
end
end

Expand Down Expand Up @@ -272,15 +271,15 @@ def test_render_array_using_implicit_serializer_and_links
data: [
{
id: assigns(:profiles).first.id.to_s,
type: "profiles",
type: 'profiles',
attributes: {
name: "Name 1",
description: "Description 1"
name: 'Name 1',
description: 'Description 1'
}
}
],
links: {
self: "http://example.com/api/profiles/1"
self: 'http://example.com/api/profiles/1'
}
}

Expand Down
9 changes: 9 additions & 0 deletions test/adapter/json_api/links_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ def test_toplevel_links
assert_equal(expected, hash[:links])
end

def test_nil_toplevel_links
hash = ActiveModel::SerializableResource.new(
@post,
adapter: :json_api,
links: nil
).serializable_hash
assert_equal(nil, hash[:links])
end

def test_resource_links
hash = serializable(@author, adapter: :json_api).serializable_hash
expected = {
Expand Down
101 changes: 0 additions & 101 deletions test/adapter/json_api/top_level_links_test.rb

This file was deleted.

0 comments on commit 37e4f1c

Please sign in to comment.