Sha256: a9b4791ba31a7c86f66e9aaa62a75f8970b76a1a84a1a2bfdfb8aea7bc16a6de

Contents?: true

Size: 620 Bytes

Versions: 9

Compression:

Stored size: 620 Bytes

Contents

require 'test_helper'

module ActiveModel
  class Serializer
    class FieldsetTest < Minitest::Test

      def test_fieldset_with_hash
        fieldset = ActiveModel::Serializer::Fieldset.new({'post' => ['id', 'title'], 'coment' => ['body']})

        assert_equal(
          {:post=>[:id, :title], :coment=>[:body]}, 
          fieldset.fields
        )
      end

      def test_fieldset_with_array_of_fields_and_root_name
        fieldset = ActiveModel::Serializer::Fieldset.new(['title'], 'post')

        assert_equal(
          {:post => [:title]}, 
          fieldset.fields
        )
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
cm-active_model_serializers-0.10.0.rc1.1 test/serializers/fieldset_test.rb
cheap_ams-0.10.5 test/serializers/fieldset_test.rb
cheap_ams-0.10.4 test/serializers/fieldset_test.rb
cheap_ams-0.10.3 test/serializers/fieldset_test.rb
cheap_ams-0.10.2 test/serializers/fieldset_test.rb
cheap_ams-0.10.1 test/serializers/fieldset_test.rb
cheap_ams-0.10.0.rc2 test/serializers/fieldset_test.rb
active_model_serializers-0.10.0.rc2 test/serializers/fieldset_test.rb
active_model_serializers-0.10.0.rc1 test/serializers/fieldset_test.rb