Sha256: e7ef6f9c683f611472df587f55cedcdae47fb4ff3b9856b1aa190d5b2adb2e99

Contents?: true

Size: 641 Bytes

Versions: 2

Compression:

Stored size: 641 Bytes

Contents

require 'spec_helper'

describe AutoIncrement::Incrementor do
  {
    nil => 1, 0 => 1, 1 => 2, 'A' => 'B', 'Z' => 'AA', 'AA' => 'AB', 'AAAAA' => 'AAAAB'
  }.each do |previous_value, next_value|
    describe "increment value for #{previous_value}" do
      it {
        allow(subject).to receive(:maximum) { previous_value }
        expect(subject.send(:increment)).to eq next_value
      }
    end
  end

  describe "initial value of string" do
    subject {
      AutoIncrement::Incrementor.new initial: 'A'
    }

    it {
      allow(subject).to receive(:maximum) { nil }
      expect(subject.send(:increment)).to eq 'A'
    }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
auto_increment-1.1.1 spec/lib/incrementor_spec.rb
auto_increment-1.1.0 spec/lib/incrementor_spec.rb