Sha256: fcd2ab8b31d050df5ed21efeb20d69e7c2c40e878777d1843ce328869bf3dda6

Contents?: true

Size: 495 Bytes

Versions: 16

Compression:

Stored size: 495 Bytes

Contents

require "test_helper"

class RenderNilTest < MiniTest::Spec
  Song = Struct.new(:title)

  describe "render_nil: true" do
    representer! do
      property :title, render_nil: true
    end

    it { Song.new.extend(representer).to_hash.must_equal({"title"=>nil}) }
  end

  describe "with :extend it shouldn't extend nil" do
    representer! do
      property :title, render_nil: true, extend: Class
    end

    it { Song.new.extend(representer).to_hash.must_equal({"title"=>nil}) }
  end
end

Version data entries

16 entries across 12 versions & 1 rubygems

Version Path
representable-3.0.4 test/render_nil_test.rb
representable-3.0.3 test/render_nil_test.rb
representable-3.0.2 test/render_nil_test.rb
representable-3.0.1 test/render_nil_test.rb
representable-3.0.0 test/render_nil_test.rb
representable-2.4.1 test-with-deprecations/render_nil_test.rb
representable-2.4.1 test/render_nil_test.rb
representable-2.4.0 test-with-deprecations/render_nil_test.rb
representable-2.4.0 test/render_nil_test.rb
representable-2.4.0.rc5 test/render_nil_test.rb
representable-2.4.0.rc5 test-with-deprecations/render_nil_test.rb
representable-2.4.0.rc4 test/render_nil_test.rb
representable-2.4.0.rc4 test-with-deprecations/render_nil_test.rb
representable-2.4.0.rc3 test/render_nil_test.rb
representable-2.4.0.rc2 test/render_nil_test.rb
representable-2.4.0.rc1 test/render_nil_test.rb