Sha256: 5b43f3f941f9bbe50d3b8c28b207d9c3e58c6c41d88147bf5c408a7599133dd0

Contents?: true

Size: 1.18 KB

Versions: 32

Compression:

Stored size: 1.18 KB

Contents

require 'flipper/types/percentage_of_actors'

RSpec.describe Flipper::Types::Percentage do
  subject do
    described_class.new(5)
  end
  it_should_behave_like 'a percentage'

  describe '.wrap' do
    context 'with percentage instance' do
      it 'returns percentage instance' do
        expect(described_class.wrap(subject)).to eq(subject)
      end
    end

    context 'with Integer' do
      it 'returns percentage instance' do
        expect(described_class.wrap(subject.value)).to eq(subject)
      end
    end

    context 'with String' do
      it 'returns percentage instance' do
        expect(described_class.wrap(subject.value.to_s)).to eq(subject)
      end
    end
  end

  describe '#eql?' do
    it 'returns true for same class and value' do
      expect(subject.eql?(described_class.new(subject.value))).to eq(true)
    end

    it 'returns false for different value' do
      expect(subject.eql?(described_class.new(subject.value + 1))).to eq(false)
    end

    it 'returns false for different class' do
      expect(subject.eql?(Object.new)).to eq(false)
    end

    it 'is aliased to ==' do
      expect((subject == described_class.new(subject.value))).to eq(true)
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
flipper-1.3.2 spec/flipper/types/percentage_spec.rb
flipper-1.3.1 spec/flipper/types/percentage_spec.rb
flipper-1.3.0 spec/flipper/types/percentage_spec.rb
flipper-1.3.0.pre spec/flipper/types/percentage_spec.rb
flipper-1.2.2 spec/flipper/types/percentage_spec.rb
flipper-1.2.1 spec/flipper/types/percentage_spec.rb
flipper-1.2.0 spec/flipper/types/percentage_spec.rb
flipper-1.1.2 spec/flipper/types/percentage_spec.rb
flipper-1.1.1 spec/flipper/types/percentage_spec.rb
flipper-1.1.0 spec/flipper/types/percentage_spec.rb
flipper-1.0.0 spec/flipper/types/percentage_spec.rb
flipper-1.0.0.pre spec/flipper/types/percentage_spec.rb
flipper-0.28.3 spec/flipper/types/percentage_spec.rb
flipper-0.28.2 spec/flipper/types/percentage_spec.rb
flipper-0.28.1 spec/flipper/types/percentage_spec.rb
flipper-0.28.0 spec/flipper/types/percentage_spec.rb
flipper-0.27.1 spec/flipper/types/percentage_spec.rb
flipper-0.27.0 spec/flipper/types/percentage_spec.rb
flipper-0.26.2 spec/flipper/types/percentage_spec.rb
flipper-0.26.1 spec/flipper/types/percentage_spec.rb