From c2dcad79b3243eefc56deca7cfe0a152cd36b966 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 16 Oct 2017 17:14:40 +0200 Subject: [PATCH] adds video spec --- spec/factories.rb | 6 ++++++ spec/features/polls/polls_spec.rb | 9 +++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/spec/factories.rb b/spec/factories.rb index a28471efc..cf3b8f88a 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -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}" } diff --git a/spec/features/polls/polls_spec.rb b/spec/features/polls/polls_spec.rb index 96787bc9e..2793fafdf 100644 --- a/spec/features/polls/polls_spec.rb +++ b/spec/features/polls/polls_spec.rb @@ -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