Sha256: 5ab137037e62a81e39f649cbd79c91406c866f49c3b941fc34975b6caf53d57a

Contents?: true

Size: 1.44 KB

Versions: 3

Compression:

Stored size: 1.44 KB

Contents

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

3 entries across 3 versions & 1 rubygems

Version Path
flipper-0.24.0 spec/flipper/actor_spec.rb
flipper-0.23.1 spec/flipper/actor_spec.rb
flipper-0.23.0 spec/flipper/actor_spec.rb