vidpush/spec/models/campaign_spec.rb
2014-04-09 14:37:46 -04:00

34 lines
749 B
Ruby

require 'spec_helper'
describe Campaign, 'associations' do
let(:campaign){ attributes_for :campaign }
it {should have_many(:videolistings) }
it 'disallows duplicate campaignid' do
one = Campaign.new(campaign)
one.save
two = Campaign.new(campaign)
two.clientid = one.clientid
expect(two.valid?).to be false
end
it 'disallows duplicate billingcode' do
one = Campaign.new(campaign)
one.save
two = Campaign.new(campaign)
two.billingcode = one.billingcode
expect(two.valid?).to be false
end
it 'disallows duplicate listingcode' do
one = Campaign.new(campaign)
one.save
two = Campaign.new(campaign)
two.listingcode = one.listingcode
expect(two.valid?).to be false
end
end