Sha256: b5746b370fc5e0d1fda4e36ef474a29417971b74d57d67f85057979d7e2ecbfa

Contents?: true

Size: 490 Bytes

Versions: 2

Compression:

Stored size: 490 Bytes

Contents

require_relative "../lib/exists"
require "minitest/autorun"

describe Exists do
  describe "Object#exists" do
    it "returns itself for non-null objects" do
      object = Object.new
      assert_equal object, object.exists
    end

    it "returns nil for nil" do
      assert_equal nil, nil.exists
    end

    it "returns nil for custom null objects" do
      null_object = Object.new
      def null_object.null?() true end
      assert_equal nil, null_object.exists
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
exists-1.0.1 spec/exists_spec.rb
exists-1.0.0 spec/exists_spec.rb