2015-10-28 21:55:59 +01:00
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: barcodes
|
|
|
|
#
|
|
|
|
# id :integer not null, primary key
|
|
|
|
# product_id :integer
|
|
|
|
# code :string default(""), not null
|
|
|
|
# created_at :datetime
|
|
|
|
# updated_at :datetime
|
|
|
|
#
|
|
|
|
|
2015-09-26 16:26:58 +02:00
|
|
|
describe Barcode do
|
|
|
|
before :each do
|
|
|
|
@barcode = create :barcode
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'has a valid factory' do
|
|
|
|
expect(@barcode).to be_valid
|
|
|
|
end
|
|
|
|
|
|
|
|
############
|
|
|
|
# FIELDS #
|
|
|
|
############
|
|
|
|
|
|
|
|
describe 'fields' do
|
|
|
|
describe 'code' do
|
|
|
|
it 'should be present' do
|
|
|
|
@barcode.code = nil
|
|
|
|
expect(@barcode).to_not be_valid
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should be unique' do
|
|
|
|
barcode = build :barcode, code: @barcode.code
|
|
|
|
expect(barcode).to_not be_valid
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|