Sha256: a71716df3596b046f9a741b22e29bee44f86d9b8db593fa5a7414855664193df

Contents?: true

Size: 1.16 KB

Versions: 8

Compression:

Stored size: 1.16 KB

Contents

require 'helper'
require 'flipper/types/percentage_of_actors'

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

  describe ".wrap" do
    context "with percentage instance" do
      it "returns percentage instance" do
        described_class.wrap(subject).should eq(subject)
      end
    end

    context "with Integer" do
      it "returns percentage instance" do
        described_class.wrap(subject.value).should eq(subject)
      end
    end

    context "with String" do
      it "returns percentage instance" do
        described_class.wrap(subject.value.to_s).should eq(subject)
      end
    end
  end

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

    it "returns false for different value" do
      subject.eql?(described_class.new(subject.value + 1)).should eq(false)
    end

    it "returns false for different class" do
      subject.eql?(Object.new).should eq(false)
    end

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
flipper-0.7.1 spec/flipper/types/percentage_spec.rb
flipper-0.7.0 spec/flipper/types/percentage_spec.rb
flipper-0.7.0.beta6 spec/flipper/types/percentage_spec.rb
flipper-0.7.0.beta5 spec/flipper/types/percentage_spec.rb
flipper-0.7.0.beta4 spec/flipper/types/percentage_spec.rb
flipper-0.7.0.beta3 spec/flipper/types/percentage_spec.rb
flipper-0.7.0.beta2 spec/flipper/types/percentage_spec.rb
flipper-0.7.0.beta1 spec/flipper/types/percentage_spec.rb