spec/sequence_spec.rb in sqlserver-sequence-0.2.0 vs spec/sequence_spec.rb in sqlserver-sequence-0.3.0

- old
+ new

@@ -1,17 +1,14 @@ require 'spec_helper' -class Supplier < ActiveRecord::Base; end - describe Sqlserver::Sequence do - after(:each) { Supplier.sequences = {} } + before { spawn_model :Supplier } describe '.sequences' do context 'single sequence' do - before do Supplier.sequence :number, name: 'sequence', prefix: 'N' end let(:expected) do @@ -26,11 +23,10 @@ specify { expect(Supplier.sequences).to eq(expected) } end context 'multiple sequences' do - before do Supplier.sequence :number1, name: 'sequence1', prefix: 'N' Supplier.sequence :number2, name: 'sequence2', prefix: 'N' end @@ -51,11 +47,10 @@ specify { expect(Supplier.sequences).to eq(expected) } end context 'with defaults' do - before do Supplier.sequence :number end let(:expected) do @@ -67,23 +62,9 @@ } } end specify { expect(Supplier.sequences).to eq(expected) } - end - end - - describe '#next_sequence_number' do - - before do - Supplier.sequence :number - end - - let!(:supplier) { Supplier.create } - let!(:other_supplier) { Supplier.create } - - it 'returns the next value' do - expect(other_supplier.number).to be > supplier.number end end describe 'saving' do