2013-09-18 12:44:41 +02:00
|
|
|
require_relative '../spec_helper'
|
2013-07-14 02:49:40 +02:00
|
|
|
|
|
|
|
describe Supplier do
|
2013-09-18 12:44:41 +02:00
|
|
|
let(:supplier) { create :supplier }
|
2013-07-14 02:49:40 +02:00
|
|
|
|
|
|
|
it 'has a unique name' do
|
2013-09-18 12:44:41 +02:00
|
|
|
supplier2 = build :supplier, name: supplier.name
|
2013-07-24 22:46:25 +02:00
|
|
|
expect(supplier2).to be_invalid
|
2013-07-14 02:49:40 +02:00
|
|
|
end
|
|
|
|
|
2013-07-15 00:17:07 +02:00
|
|
|
it 'has valid articles' do
|
2013-09-18 12:44:41 +02:00
|
|
|
supplier = create :supplier, article_count: true
|
2013-07-24 22:46:25 +02:00
|
|
|
supplier.articles.all.each {|a| expect(a).to be_valid }
|
2013-07-15 00:17:07 +02:00
|
|
|
end
|
|
|
|
|
2013-07-14 02:49:40 +02:00
|
|
|
end
|