adds video spec

This commit is contained in:
rgarcia
2017-10-16 17:14:40 +02:00
parent 279adaa00d
commit c2dcad79b3
2 changed files with 9 additions and 6 deletions

View File

@@ -507,6 +507,12 @@ FactoryGirl.define do
sequence(:description) { |n| "Question description #{n}" }
end
factory :poll_answer_video, class: 'Poll::Question::Answer::Video' do
association :answer, factory: :poll_question_answer
title "Sample video title"
url "http://sample-video-url.org"
end
factory :poll_booth, class: 'Poll::Booth' do
sequence(:name) { |n| "Booth #{n}" }
sequence(:location) { |n| "Street #{n}" }

View File

@@ -67,15 +67,12 @@ feature 'Polls' do
scenario 'Show answers with videos' do
question = create(:poll_question, poll: poll)
answer1 = create(:poll_question_answer, question: question, title: 'Chewbacca')
answer2 = create(:poll_question_answer, question: question, title: 'Han Solo',
video_title: "Awesome project video",
video_url: "https://www.youtube.com/watch?v=123")
answer = create(:poll_question_answer, question: question, title: 'Chewbacca')
video = create(:poll_answer_video, answer: answer, title: "Awesome project video", url: "https://www.youtube.com/watch?v=123")
visit poll_path(poll)
expect(page).to have_link("Awesome project video", href: "https://www.youtube.com/watch?v=123")
end
scenario 'Lists questions from proposals as well as regular ones' do