From 58c95ccca47e9f38aa43772a8fe1fea14c8c5c4a Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Thu, 29 May 2014 16:57:34 -0400 Subject: [PATCH] fix tests to add new field. --- app/controllers/videolistings_controller.rb | 2 +- app/models/videolisting.rb | 4 ++-- spec/factories/videolistings.rb | 1 + spec/models/videolisting_spec.rb | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/controllers/videolistings_controller.rb b/app/controllers/videolistings_controller.rb index b067617..9d43b42 100644 --- a/app/controllers/videolistings_controller.rb +++ b/app/controllers/videolistings_controller.rb @@ -33,7 +33,7 @@ class VideolistingsController < ApplicationController # Only allow a trusted parameter "white list" through. 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 def not_found diff --git a/app/models/videolisting.rb b/app/models/videolisting.rb index 19b3d75..e217d85 100644 --- a/app/models/videolisting.rb +++ b/app/models/videolisting.rb @@ -9,7 +9,7 @@ class Videolisting < ActiveRecord::Base after_initialize :set_defaults def get_video_url - if on_s3 + if self.on_s3 == true "http://s3.amazonaws.com/#{ENV['VIDEO_BUCKET']}/bvideos/#{videocode}.mp4" else "http://video2.bettervideo.com/video/pro/MP4640x360/720.#{videocode}.mp4" @@ -17,7 +17,7 @@ class Videolisting < ActiveRecord::Base end def get_preview_url - if on_s3 + if self.on_s3 == true "http://s3.amazonaws.com/#{ENV['VIDEO_BUCKET']}/bvideos_preview/#{videocode}.jpg" else "http://video2.bettervideo.com/video/pro/jpg640x360/720.#{videocode}.jpg" diff --git a/spec/factories/videolistings.rb b/spec/factories/videolistings.rb index 5892da3..5e2a0af 100644 --- a/spec/factories/videolistings.rb +++ b/spec/factories/videolistings.rb @@ -9,6 +9,7 @@ FactoryGirl.define do producttypeid 721 toneofvideo "Upbeat, targeting families but also show business functions." voiceoverselection 3 + on_s3 false published {|x| false } sequence(:videocode) {|x| "video#{x}" } end diff --git a/spec/models/videolisting_spec.rb b/spec/models/videolisting_spec.rb index d8a9dc7..fd780e9 100644 --- a/spec/models/videolisting_spec.rb +++ b/spec/models/videolisting_spec.rb @@ -21,11 +21,11 @@ describe Videolisting, 'associations' do 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") + 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("http://video2.bettervideo.com/video/pro/jpg640x360/720.") + expect(video.get_preview_url).to include("#{video.videocode}.jpg") end end \ No newline at end of file