vidpush/spec/models/videolisting_spec.rb
2014-04-25 16:02:47 -04:00

31 lines
947 B
Ruby

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
it "can get a video url" do
video = FactoryGirl.build(:videolisting)
expect(video.get_video_url).to include("http://video2.bettervideo.com/video/pro/MP4640x360/720")
end
it "can get a preview url" do
video = FactoryGirl.build(:videolisting)
expect(video.get_preview_url).to include("http://video2.bettervideo.com/video/pro/jpg640x360/720.")
end
end