Sha256: 4694a950043dacadc592991aa627a12fd0ad85493ff9f3d514d938d25b6db799

Contents?: true

Size: 625 Bytes

Versions: 5

Compression:

Stored size: 625 Bytes

Contents

covers 'facets/kernel/presence'

test_case Kernel do

  method :presence do

    test do
      "a".presence.assert == "a"
      [1].presence.assert == [1]
      {:a=>1}.presence.assert == {:a=>1}
    end

    test do
      "".presence.assert == nil
      [].presence.assert == nil
      {}.presence.assert == nil
    end

  end

  method :present? do

    test "non-empty objects are present" do
      "a".assert.present?
      [1].assert.present?
      {:a=>1}.assert.present?
    end

    test "empty object are not present" do
      "".refute.present?
      [].refute.present?
      {}.refute.present?
    end

  end

end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 test/core/kernel/test_presence.rb
facets-3.1.0 test/core/kernel/test_presence.rb
facets-3.0.0 test/core/kernel/test_presence.rb
facets-2.9.3 test/core/kernel/test_presence.rb
facets-2.9.2 test/core/kernel/test_presence.rb