Sha256: e0a08ac42f56fb4ad4064ada780b52ec67a5d0d8fbc145bb1353c46af4a36385

Contents?: true

Size: 1.45 KB

Versions: 38

Compression:

Stored size: 1.45 KB

Contents

require 'helper'

RSpec.describe Flipper::Actor do
  it 'initializes with and knows flipper_id' do
    actor = described_class.new("User;235")
    expect(actor.flipper_id).to eq("User;235")
  end

  describe '#eql?' do
    it 'returns true if same class and flipper_id' do
      actor1 = described_class.new("User;235")
      actor2 = described_class.new("User;235")
      expect(actor1.eql?(actor2)).to be(true)
    end

    it 'returns false if same class but different flipper_id' do
      actor1 = described_class.new("User;235")
      actor2 = described_class.new("User;1")
      expect(actor1.eql?(actor2)).to be(false)
    end

    it 'returns false for different class' do
      actor1 = described_class.new("User;235")
      actor2 = Struct.new(:flipper_id).new("User;235")
      expect(actor1.eql?(actor2)).to be(false)
    end
  end

  describe '#==' do
    it 'returns true if same class and flipper_id' do
      actor1 = described_class.new("User;235")
      actor2 = described_class.new("User;235")
      expect(actor1.==(actor2)).to be(true)
    end

    it 'returns false if same class but different flipper_id' do
      actor1 = described_class.new("User;235")
      actor2 = described_class.new("User;1")
      expect(actor1.==(actor2)).to be(false)
    end

    it 'returns false for different class' do
      actor1 = described_class.new("User;235")
      actor2 = Struct.new(:flipper_id).new("User;235")
      expect(actor1.==(actor2)).to be(false)
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
flipper-0.22.2 spec/flipper/actor_spec.rb
flipper-0.22.1 spec/flipper/actor_spec.rb
flipper-0.22.0 spec/flipper/actor_spec.rb
flipper-0.21.0 spec/flipper/actor_spec.rb
flipper-0.21.0.rc2 spec/flipper/actor_spec.rb
flipper-0.21.0.rc1 spec/flipper/actor_spec.rb
flipper-0.20.4 spec/flipper/actor_spec.rb
flipper-0.20.3 spec/flipper/actor_spec.rb
flipper-0.20.2 spec/flipper/actor_spec.rb
flipper-0.20.1 spec/flipper/actor_spec.rb
flipper-0.20.0 spec/flipper/actor_spec.rb
flipper-0.20.0.beta3 spec/flipper/actor_spec.rb
flipper-0.20.0.beta2 spec/flipper/actor_spec.rb
flipper-0.20.0.beta1 spec/flipper/actor_spec.rb
flipper-0.19.1 spec/flipper/actor_spec.rb
flipper-0.19.0 spec/flipper/actor_spec.rb
flipper-0.18.0 spec/flipper/actor_spec.rb
flipper-0.17.2 spec/flipper/actor_spec.rb
flipper-0.17.1 spec/flipper/actor_spec.rb
flipper-0.16.2 spec/flipper/actor_spec.rb