Sha256: 1d1ca89d01fc03a964d7361a85b2506f570663b7825fd6f26d3f2c927b376461

Contents?: true

Size: 501 Bytes

Versions: 5

Compression:

Stored size: 501 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

5 entries across 5 versions & 3 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/representable-3.2.0/test/render_nil_test.rb
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/representable-3.2.0/test/render_nil_test.rb
representable-3.2.0 test/render_nil_test.rb
representable-3.1.1 test/render_nil_test.rb
representable-3.1.0 test/render_nil_test.rb