active_model_serializers/test/include_tree/from_include_args_test.rb
Benjamin Fleischer 419faf03b9 Favor ActiveSupport::TestCase over Minitest::Test
- Better minitest 4/5 support
- Better DSL
- Already available with no changes
- Consistent interface
2015-12-22 10:35:51 -06:00

27 lines
832 B
Ruby

require 'test_helper'
module ActiveModel
class Serializer
class IncludeTree
class FromStringTest < ActiveSupport::TestCase
def test_simple_array
input = [:comments, :author]
actual = ActiveModel::Serializer::IncludeTree.from_include_args(input)
assert(actual.key?(:author))
assert(actual.key?(:comments))
end
def test_nested_array
input = [:comments, posts: [:author, comments: [:author]]]
actual = ActiveModel::Serializer::IncludeTree.from_include_args(input)
assert(actual.key?(:posts))
assert(actual[:posts].key?(:author))
assert(actual[:posts].key?(:comments))
assert(actual[:posts][:comments].key?(:author))
assert(actual.key?(:comments))
end
end
end
end
end