tap/spec/models/barcode_spec.rb

35 lines
652 B
Ruby
Raw Normal View History

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
2015-10-28 21:54:55 +01:00
describe 'product' do
it 'should be present' do
@barcode.product = nil
expect(@barcode).to_not be_valid
end
end
2015-09-26 16:26:58 +02:00
end
end