Sha256: 6722cd0a4b53d8ff6d3813c36a4bfad7614917aac795bbb46177819de9db26ce

Contents?: true

Size: 832 Bytes

Versions: 3

Compression:

Stored size: 832 Bytes

Contents

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active_model_serializers-0.10.0 test/include_tree/from_include_args_test.rb
active_model_serializers-0.10.0.rc5 test/include_tree/from_include_args_test.rb
active_model_serializers-0.10.0.rc4 test/include_tree/from_include_args_test.rb