File: null_test.rb

package info (click to toggle)
ruby-active-model-serializers 0.10.12-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,752 kB
  • sloc: ruby: 13,138; sh: 53; makefile: 6
file content (24 lines) | stat: -rw-r--r-- 573 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

require 'test_helper'

module ActiveModelSerializers
  module Adapter
    class NullTest < ActiveSupport::TestCase
      def setup
        profile = Profile.new(name: 'Name 1', description: 'Description 1', comments: 'Comments 1')
        serializer = ProfileSerializer.new(profile)

        @adapter = Null.new(serializer)
      end

      def test_serializable_hash
        assert_equal({}, @adapter.serializable_hash)
      end

      def test_it_returns_empty_json
        assert_equal('{}', @adapter.to_json)
      end
    end
  end
end