Merge pull request #2020 from consul/poll-videos

Poll answer videos
This commit is contained in:
BertoCQ
2017-10-16 20:03:34 +02:00
committed by GitHub
6 changed files with 59 additions and 0 deletions

View File

@@ -41,6 +41,31 @@ feature 'Answers' do
expect(page).to have_content "Adding more trees, creating a play area..."
end
scenario 'Add video to answer' do
question = create(:poll_question)
answer1 = create(:poll_question_answer, question: question)
answer2 = create(:poll_question_answer, question: question)
visit admin_question_path(question)
within("#poll_question_answer_#{answer1.id}") do
click_link "Video list"
end
click_link "Add video"
fill_in "poll_question_answer_video_title", with: "Awesome project video"
fill_in "poll_question_answer_video_url", with: "https://www.youtube.com/watch?v=123"
click_button "Save"
within("#poll_question_answer_video_#{answer1.id}") do
expect(page).to have_content "Awesome project video"
expect(page).to have_content "https://www.youtube.com/watch?v=123"
end
end
pending "Update"
pending "Destroy"

View File

@@ -65,6 +65,16 @@ feature 'Polls' do
let(:geozone) { create(:geozone) }
let(:poll) { create(:poll, summary: "Summary", description: "Description") }
scenario 'Show answers with videos' do
question = create(:poll_question, poll: poll)
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
normal_question = create(:poll_question, poll: poll)
proposal_question = create(:poll_question, poll: poll, proposal: create(:proposal))