vidpush/spec/models/videolisting_spec.rb

31 lines
882 B
Ruby
Raw Normal View History

2014-04-07 18:41:34 +00:00
require 'spec_helper'
describe Videolisting, 'associations' do
2014-04-09 18:37:46 +00:00
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
2014-04-24 21:13:39 +00:00
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
2014-04-25 20:02:47 +00:00
it "can get a video url" do
video = FactoryGirl.build(:videolisting)
2014-05-29 20:57:34 +00:00
expect(video.get_video_url).to include("#{video.videocode}.mp4")
2014-04-25 20:02:47 +00:00
end
it "can get a preview url" do
video = FactoryGirl.build(:videolisting)
2014-05-29 20:57:34 +00:00
expect(video.get_preview_url).to include("#{video.videocode}.jpg")
2014-04-25 20:02:47 +00:00
end
2014-04-07 18:41:34 +00:00
end