Sha256: e4096f87138d4c1c612c2569dbe86ed8dab5845eaa6d828e5280a40f5b2d47ad
Contents?: true
Size: 1.9 KB
Versions: 2
Compression:
Stored size: 1.9 KB
Contents
describe Unidom::Sequence::Sequence, type: :model do subject :sequentiality_code do 'ODNO' end subject :prefix do 'ORDER-20171225' end before :each do end after :each do end it 'should be able to generate 1 new serial number' do serial_number = described_class.generate! sequentiality_code, prefix expect(serial_number).to eq(1) end it 'should be able to generate 2 new serial numbers' do serial_number_1 = described_class.generate! sequentiality_code, prefix expect(serial_number_1).to eq(1) serial_number_2 = described_class.generate! sequentiality_code, prefix expect(serial_number_2).to eq(2) end it 'should be able to generate 1 new serial number with empty prefix' do serial_number = described_class.generate! sequentiality_code expect(serial_number).to eq(1) end it 'should be able to generate 2 new serial numbers with empty prefix' do serial_number_1 = described_class.generate! sequentiality_code expect(serial_number_1).to eq(1) serial_number_2 = described_class.generate! sequentiality_code expect(serial_number_2).to eq(2) end context do model_attributes = { sequentiality_code: 'ZZZZ', prefix: '110116' } it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes it_behaves_like 'scope', :prefix_is, [ { attributes_collection: [ model_attributes ], count_diff: 0, args: [ '110115' ] }, { attributes_collection: [ model_attributes ], count_diff: 0, args: [ 110115 ] }, { attributes_collection: [ model_attributes ], count_diff: 1, args: [ '110116' ] }, { attributes_collection: [ model_attributes ], count_diff: 1, args: [ 110116 ] }, { attributes_collection: [ model_attributes ], count_diff: 0, args: [ '110117' ] }, { attributes_collection: [ model_attributes ], count_diff: 0, args: [ 110117 ] } ] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
unidom-sequence-1.0 | lib/rspec/models/unidom/sequence/sequence_spec.rb |
unidom-sequence-0.3.2 | lib/rspec/models/unidom/sequence/sequence_spec.rb |