spec/lib/incrementor_spec.rb in auto_increment-1.1.1 vs spec/lib/incrementor_spec.rb in auto_increment-1.2.0

- old
+ new

@@ -1,25 +1,31 @@ require 'spec_helper' describe AutoIncrement::Incrementor do { - nil => 1, 0 => 1, 1 => 2, 'A' => 'B', 'Z' => 'AA', 'AA' => 'AB', 'AAAAA' => 'AAAAB' + 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 { + it do allow(subject).to receive(:maximum) { previous_value } expect(subject.send(:increment)).to eq next_value - } + end end end - describe "initial value of string" do - subject { + describe 'initial value of string' do + subject do AutoIncrement::Incrementor.new initial: 'A' - } + end - it { + it do allow(subject).to receive(:maximum) { nil } expect(subject.send(:increment)).to eq 'A' - } + end end end