Sha256: cfff950399525517e336734459264d3d598777f34bdec2774247fa23633e3aaf

Contents?: true

Size: 624 Bytes

Versions: 6

Compression:

Stored size: 624 Bytes

Contents

require 'test_helper'

module ActiveModel
  class Serializer
    class FieldsetTest < Minitest::Test
      def test_fieldset_with_hash
        fieldset = ActiveModel::Serializer::Fieldset.new({ 'post' => %w(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

6 entries across 6 versions & 2 rubygems

Version Path
active_model_serializers-0.10.0.rc3 test/serializers/fieldset_test.rb
cheap_ams-0.10.11 test/serializers/fieldset_test.rb
cheap_ams-0.10.10 test/serializers/fieldset_test.rb
cheap_ams-0.10.8 test/serializers/fieldset_test.rb
cheap_ams-0.10.7 test/serializers/fieldset_test.rb
cheap_ams-0.10.6 test/serializers/fieldset_test.rb