Sha256: 3cc39abb1aa3fd4370289abb6b79b951b8f074a528507ac3db5dc1800004ab87

Contents?: true

Size: 1.2 KB

Versions: 39

Compression:

Stored size: 1.2 KB

Contents

require 'helper'
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

39 entries across 39 versions & 1 rubygems

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