mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Remove url options
Removing url options because It does not works at all. Thus, there are others PR at the moment to include url(links) as well.
This commit is contained in:
1
test/fixtures/active_record.rb
vendored
1
test/fixtures/active_record.rb
vendored
@@ -40,7 +40,6 @@ module ARModels
|
||||
|
||||
has_many :comments
|
||||
belongs_to :author
|
||||
url :comments
|
||||
end
|
||||
|
||||
class CommentSerializer < ActiveModel::Serializer
|
||||
|
||||
5
test/fixtures/poro.rb
vendored
5
test/fixtures/poro.rb
vendored
@@ -59,8 +59,6 @@ end
|
||||
class ProfileSerializer < ActiveModel::Serializer
|
||||
attributes :name, :description
|
||||
|
||||
urls :posts, :comments
|
||||
|
||||
def arguments_passed_in?
|
||||
options[:my_options] == :accessible
|
||||
end
|
||||
@@ -68,8 +66,6 @@ end
|
||||
|
||||
class ProfilePreviewSerializer < ActiveModel::Serializer
|
||||
attributes :name
|
||||
|
||||
urls :posts, :comments
|
||||
end
|
||||
|
||||
Post = Class.new(Model)
|
||||
@@ -100,7 +96,6 @@ PostSerializer = Class.new(ActiveModel::Serializer) do
|
||||
has_many :comments
|
||||
belongs_to :blog
|
||||
belongs_to :author
|
||||
url :comments
|
||||
|
||||
def blog
|
||||
Blog.new(id: 999, name: 'Custom blog')
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
require 'test_helper'
|
||||
|
||||
module ActiveModel
|
||||
class Serializer
|
||||
class UrlsTest < Minitest::Test
|
||||
def setup
|
||||
@profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
|
||||
@post = Post.new({ title: 'New Post', body: 'Body' })
|
||||
@comment = Comment.new({ id: 1, body: 'ZOMG A COMMENT' })
|
||||
@post.comments = [@comment]
|
||||
|
||||
@profile_serializer = ProfileSerializer.new(@profile)
|
||||
@post_serializer = PostSerializer.new(@post)
|
||||
end
|
||||
|
||||
def test_urls_definition
|
||||
assert_equal([:posts, :comments], @profile_serializer.class._urls)
|
||||
end
|
||||
|
||||
def test_url_definition
|
||||
assert_equal([:comments], @post_serializer.class._urls)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user