Sha256: a6a1ef71d296d7f36b4ad074e1e053f0c7681d2351f705aaa404e540bfd63619

Contents?: true

Size: 927 Bytes

Versions: 36

Compression:

Stored size: 927 Bytes

Contents

require "spec_helper"
require "securerandom"

class FogTestModel < Fog::Model
  identity  :id
end

describe Fog::Model do
  describe "#==" do
    it "is not equal if one is not a Fog::Model" do
      a = FogTestModel.new
      b = 2
      refute_equal a, b
      refute_equal b, a
    end

    it "is equal if it is the same object" do
      a = b = FogTestModel.new
      assert_equal a, b
    end

    it "is equal if it has the same non-nil identity and the same class" do
      id = SecureRandom.hex
      assert_equal FogTestModel.new(:id => id), FogTestModel.new(:id => id)
    end

    it "is not equal if both have nil identity, but are different objects" do
      refute_equal FogTestModel.new, FogTestModel.new
    end

    it "is not equal if it has a different identity" do
      refute_equal FogTestModel.new(:id => SecureRandom.hex),
                   FogTestModel.new(:id => SecureRandom.hex)
    end
  end
end

Version data entries

36 entries across 33 versions & 3 rubygems

Version Path
fog-core-2.3.0 spec/core/model_spec.rb
fog-core-2.2.4 spec/core/model_spec.rb
fog-core-2.2.3 spec/core/model_spec.rb
fog-core-2.2.2 spec/core/model_spec.rb
fog-core-2.2.1 spec/core/model_spec.rb
fog-core-2.2.0 spec/core/model_spec.rb
fog-core-2.1.2 spec/core/model_spec.rb
fog-core-2.1.1 spec/core/model_spec.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-core-1.45.0/spec/core/model_spec.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-core-1.45.0/spec/core/model_spec.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-core-2.1.0/spec/core/model_spec.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-core-1.45.0/spec/core/model_spec.rb
fog-core-2.1.0 spec/core/model_spec.rb
fog-core-2.0.0 spec/core/model_spec.rb
fog-core-1.45.0 spec/core/model_spec.rb
fog-core-1.44.3 spec/core/model_spec.rb
fog-core-1.44.2 spec/core/model_spec.rb
fog-core-1.44.1 spec/core/model_spec.rb
fog-core-1.44.0 spec/core/model_spec.rb
fog-core-1.43.0 spec/core/model_spec.rb