vidpush/spec/models/campaign_spec.rb

34 lines
749 B
Ruby
Raw Normal View History

2014-04-07 18:41:34 +00:00
require 'spec_helper'
describe Campaign, 'associations' do
2014-04-09 18:37:46 +00:00
let(:campaign){ attributes_for :campaign }
2014-04-07 18:41:34 +00:00
it {should have_many(:videolistings) }
2014-04-09 18:37:46 +00:00
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
2014-04-07 18:41:34 +00:00
end