vidpush/spec/models/videolisting_spec.rb
2014-05-29 16:57:34 -04:00

31 lines
882 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("#{video.videocode}.mp4")
end
it "can get a preview url" do
video = FactoryGirl.build(:videolisting)
expect(video.get_preview_url).to include("#{video.videocode}.jpg")
end
end