Sha256: 8fc470b9a411bf98626b639f73cd84e9d1d78cb081deecad8249c65d4e9c9398

Contents?: true

Size: 643 Bytes

Versions: 1

Compression:

Stored size: 643 Bytes

Contents

require 'spec_helper'

describe Sqlserver::Sequence::Strategies::Simple do  
  
  before do
    Sqlserver::Sequence.configure do |config|
      config.next_value_strategy = Sqlserver::Sequence::Strategies::Simple
    end

    spawn_model(:Supplier) { sequence :number }
  end

  describe 'saving' do

    let!(:supplier) { Supplier.create }
    let!(:other_supplier) { Supplier.create }

    it 'returns the next value' do
      expect(other_supplier.number).to be > supplier.number
    end

    it 'uses the maximum id' do
      expected = Supplier.maximum(:id).next.to_s
      expect(Supplier.create.number).to eq expected
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sqlserver-sequence-0.3.0 spec/strategies/simple_spec.rb