require 'spec_helper' describe Videolisting, 'associations' do let(:videolisting){ attributes_for :videolisting } it { should belong_to(:campaign) } it 'disallows duplicate videocode' do one = Videolisting.new(videolisting) one.save two = Videolisting.new(videolisting) two.videocode = one.videocode expect(two.valid?).to be false end it "has asseturls array working correctly" do listing = FactoryGirl.create(:videolisting) expect(listing.asseturls_array).to include({asseturl: "http://s3.amazon.com/555555/catering.jpg"}) end end