Sha256: 723b455f4aabe2a6b2c5a00f5dbf31bd9c1c303ccc1b792980223074176b4bb1

Contents?: true

Size: 919 Bytes

Versions: 3

Compression:

Stored size: 919 Bytes

Contents

require 'spec_helper'

describe Inventory do
  it 'sets number on create' do
    inventory = Inventory.create
    expect(inventory.number).not_to be_nil
  end

  it 'creates with own number' do
    inventory = Inventory.create number: '500'
    expect(inventory.number).to eq('500')
  end

  it 'does not change number on update' do
    inventory = Inventory.create number: '5'
    inventory.touch
    expect(inventory.number).to eq('5')
  end

  it 'creates sequence of numbers' do
    expect(Inventory.create.number).to eq('1')
    expect(Inventory.create.number).to eq('2')
  end

  it 'gets array of numbers' do
    expect(Inventory.get_numbers(3)).to eq(%w(1 2 3))
  end

  it 'assigns number after initialization if has with_number' do
    expect(Inventory.new(with_number: true).number).to eq('1')
  end

  it 'does not assign number after initialization' do
    expect(Inventory.new.number).to be_nil
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
document_number-0.10.0 spec/models/inventory_spec.rb
document_number-0.9.6 spec/models/inventory_spec.rb
document_number-0.9.5 spec/models/inventory_spec.rb