fix tests to add new field.

This commit is contained in:
Tyrel Souza 2014-05-29 16:57:34 -04:00
parent 834648bd57
commit 58c95ccca4
4 changed files with 6 additions and 5 deletions

View File

@ -33,7 +33,7 @@ class VideolistingsController < ApplicationController
# Only allow a trusted parameter "white list" through. # Only allow a trusted parameter "white list" through.
def videolisting_params def videolisting_params
params.require(:videolisting).permit(:videocode, :producttypeid, :remoteassetsarchive, :voiceoverselection, :musicselection, :clientprovidedscript, :keywords, :focus, :notes, :asseturls) params.require(:videolisting).permit(:videocode, :producttypeid, :remoteassetsarchive, :voiceoverselection, :musicselection, :clientprovidedscript, :keywords, :focus, :notes, :asseturls, :on_s3)
end end
def not_found def not_found

View File

@ -9,7 +9,7 @@ class Videolisting < ActiveRecord::Base
after_initialize :set_defaults after_initialize :set_defaults
def get_video_url def get_video_url
if on_s3 if self.on_s3 == true
"http://s3.amazonaws.com/#{ENV['VIDEO_BUCKET']}/bvideos/#{videocode}.mp4" "http://s3.amazonaws.com/#{ENV['VIDEO_BUCKET']}/bvideos/#{videocode}.mp4"
else else
"http://video2.bettervideo.com/video/pro/MP4640x360/720.#{videocode}.mp4" "http://video2.bettervideo.com/video/pro/MP4640x360/720.#{videocode}.mp4"
@ -17,7 +17,7 @@ class Videolisting < ActiveRecord::Base
end end
def get_preview_url def get_preview_url
if on_s3 if self.on_s3 == true
"http://s3.amazonaws.com/#{ENV['VIDEO_BUCKET']}/bvideos_preview/#{videocode}.jpg" "http://s3.amazonaws.com/#{ENV['VIDEO_BUCKET']}/bvideos_preview/#{videocode}.jpg"
else else
"http://video2.bettervideo.com/video/pro/jpg640x360/720.#{videocode}.jpg" "http://video2.bettervideo.com/video/pro/jpg640x360/720.#{videocode}.jpg"

View File

@ -9,6 +9,7 @@ FactoryGirl.define do
producttypeid 721 producttypeid 721
toneofvideo "Upbeat, targeting families but also show business functions." toneofvideo "Upbeat, targeting families but also show business functions."
voiceoverselection 3 voiceoverselection 3
on_s3 false
published {|x| false } published {|x| false }
sequence(:videocode) {|x| "video#{x}" } sequence(:videocode) {|x| "video#{x}" }
end end

View File

@ -21,11 +21,11 @@ describe Videolisting, 'associations' do
it "can get a video url" do it "can get a video url" do
video = FactoryGirl.build(:videolisting) video = FactoryGirl.build(:videolisting)
expect(video.get_video_url).to include("http://video2.bettervideo.com/video/pro/MP4640x360/720") expect(video.get_video_url).to include("#{video.videocode}.mp4")
end end
it "can get a preview url" do it "can get a preview url" do
video = FactoryGirl.build(:videolisting) video = FactoryGirl.build(:videolisting)
expect(video.get_preview_url).to include("http://video2.bettervideo.com/video/pro/jpg640x360/720.") expect(video.get_preview_url).to include("#{video.videocode}.jpg")
end end
end end