mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
Merge pull request #68 from teeparham/unique-test-methods
rename test methods so the tests run
This commit is contained in:
commit
dc942f47c1
@ -185,24 +185,6 @@ class AssociationTest < ActiveModel::TestCase
|
||||
}, @root_hash)
|
||||
end
|
||||
|
||||
def test_with_default_has_one_with_custom_key
|
||||
@post_serializer_class.class_eval do
|
||||
has_one :comment, :key => :custom_comment
|
||||
end
|
||||
|
||||
include! :comment
|
||||
|
||||
assert_equal({
|
||||
:custom_comment => 1
|
||||
}, @hash)
|
||||
|
||||
assert_equal({
|
||||
:custom_comments => [
|
||||
{ :id => 1, :body => "ZOMG A COMMENT" }
|
||||
]
|
||||
}, @root_hash)
|
||||
end
|
||||
|
||||
def test_embed_objects_for_has_many_associations
|
||||
@post_serializer_class.class_eval do
|
||||
has_many :comments, :embed => :objects
|
||||
|
||||
@ -217,7 +217,7 @@ class RenderJsonTest < ActionController::TestCase
|
||||
assert_match '"object":{"serializable_object":true}', @response.body
|
||||
end
|
||||
|
||||
def test_render_json_with_serializer
|
||||
def test_render_json_with_serializer_checking_defaults
|
||||
get :render_json_with_serializer, :check_defaults => true
|
||||
assert_match '"scope":{"current_user":true}', @response.body
|
||||
assert_match '"object":{"serializable_object":true}', @response.body
|
||||
|
||||
@ -384,12 +384,12 @@ class SerializerTest < ActiveModel::TestCase
|
||||
serializer = array.active_model_serializer.new(array, {:scope => true})
|
||||
assert_equal([
|
||||
{ :model => "Model" },
|
||||
{ :user => { :last_name=>"Valim", :ok=>true, :first_name=>"Jose", :scope => true } },
|
||||
{ :user => { :last_name=> "Valim", :ok => true, :first_name => "Jose", :scope => true } },
|
||||
{ :comment => { :title => "Comment1" } }
|
||||
], serializer.as_json)
|
||||
end
|
||||
|
||||
def test_array_serializer
|
||||
def test_array_serializer_with_root
|
||||
comment1 = Comment.new(:title => "Comment1", :id => 1)
|
||||
comment2 = Comment.new(:title => "Comment2", :id => 2)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user