Use file name for sending content feature and unit tests

Only zencoder needs an actual file because it does not use the view to
create the content.
Signed-off-by: marcheing's avatarHeitor Reis <marcheing@gmail.com>
parent 1fa2e0e4
......@@ -11,7 +11,7 @@ Given(/^I see my name on the Author field$/) do
end
Given(/^I have a video to be uploaded$/) do
@video_attributes = attributes_for :video, :cucumber
@video_attributes = attributes_for :video, :with_file_name
end
When(/^I fill the title field with the video's title$/) do
......
......@@ -32,7 +32,7 @@ RSpec.describe ContentsController, type: :controller do
end
describe 'GET #show' do
let(:video) { build(:video, :rspec, id: 1) }
let(:video) { build(:video, :with_file_name, id: 1) }
context 'video found' do
before do
expect(Content).to receive(:find).with(video.id.to_s).and_return(video)
......@@ -62,7 +62,7 @@ RSpec.describe ContentsController, type: :controller do
end
describe 'POST #create' do
let(:video) { build(:video, with: :rspec) }
let(:video) { build(:video, with: :with_file_name) }
context 'with valid params' do
before do
expect_any_instance_of(Content).to receive(:save).and_return true
......
......@@ -6,14 +6,10 @@ FactoryGirl.define do
director 'Director'
end
trait :rspec do
trait :with_file_name do
video_file_name "#{Rails.root}/public/cucumber/videos/video.mp4"
end
trait :cucumber do
video "#{Rails.root}/public/cucumber/videos/video.mp4"
end
trait :zencoder do
video { File.new "#{Rails.root}/public/cucumber/videos/video.mp4" }
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