Commit 91b9f4b9 authored by marcheing's avatar marcheing

Fix the remaining rubocop offenses

parent bd28c3c5
......@@ -33,15 +33,7 @@ class ContentsController < ApplicationController
def zencoder_callback
@encoded_content = EncodedContent.find_by(job_id: params[:job][:id])
unless @encoded_content.nil?
@encoded_content.output_id = params[:outputs].first[:id]
@encoded_content.state = params[:outputs].first[:state]
@encoded_content.width = params[:outputs].first[:width]
@encoded_content.height = params[:outputs].first[:height]
@encoded_content.duration = params[:outputs].first[:duration_in_ms]
@encoded_content.file_size = params[:outputs].first[:file_size_in_bytes]
@encoded_content.video = URI.parse(params[:outputs].first[:url])
@encoded_content.thumbnail = URI.parse(params[:outputs].first[:thumbnails].first[:images].first[:url])
@encoded_content.save
update_encoded_content @encoded_content, params[:outputs].first
end
head :no_content
......@@ -49,6 +41,18 @@ class ContentsController < ApplicationController
private
def update_encoded_content(encoded_content, parameters)
encoded_content.output_id = parameters[:id]
encoded_content.state = parameters[:state]
encoded_content.width = parameters[:width]
encoded_content.height = parameters[:height]
encoded_content.duration = parameters[:duration_in_ms]
encoded_content.file_size = parameters[:file_size_in_bytes]
encoded_content.video = URI.parse(parameters[:url])
encoded_content.thumbnail = URI.parse(parameters[:thumbnails].first[:images].first[:url])
encoded_content.save
end
# Use callbacks to share common setup or constraints between actions.
def set_content
@content = Content.find(params[:id])
......
......@@ -4,7 +4,7 @@ class Content < ApplicationRecord
s3_credentials: AWSSettings.to_h,
s3_region: AWSSettings.aws_region
validates_attachment :video, presence: true
validates_attachment_content_type :video, content_type: /\Avideo\/.*\Z/
validates_attachment_content_type :video, content_type: %r{\Avideo\/.*\Z}
validates :terms_of_service, acceptance: true
......
......@@ -9,7 +9,7 @@ class EncodedContent < ApplicationRecord
s3_credentials: AWSSettings.to_h,
s3_region: AWSSettings.aws_region
validates_attachment_content_type :video, content_type: /\Avideo\/.*\Z/
validates_attachment_content_type :video, content_type: %r{\Avideo\/.*\Z}
validates_attachment_content_type :thumbnail, content_type: /\Aimage/
validates :content_id, :job_id, presence: true
......
......@@ -16,7 +16,7 @@ describe StaticViewsController, type: :controller do
it 'renders no layout' do
expect(response.body).to_not have_css('header.general-header') # navbar
expect(response.body).to_not have_css('footer') # footer
expect(response.body).to match /Festival do Minuto \(One Minute Festival\)\'s Rules and Regulations/
expect(response.body).to match(/Festival do Minuto \(One Minute Festival\)\'s Rules and Regulations/)
end
end
......@@ -28,7 +28,7 @@ describe StaticViewsController, type: :controller do
it 'renders no layout' do
expect(response.body).to_not have_css('header.general-header') # navbar
expect(response.body).to_not have_css('footer') # footer
expect(response.body).to match /Termos de Uso e Serviço \/ Regulamento do Festival do Minuto/
expect(response.body).to match %r{Termos de Uso e Serviço \/ Regulamento do Festival do Minuto}
end
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment