Files
nairobi/spec/system/admin/poll/questions/answers/videos/videos_spec.rb
Javi Martín 3da4ee00b8 Simplify tests requiring admin login
We were repeating the same code over and over (with a few variants) to
setup tests which require an administrator. We can use a tag and
simplify the code.
2020-12-02 15:33:19 +01:00

27 lines
700 B
Ruby

require "rails_helper"
describe "Videos", :admin do
scenario "Create" do
question = create(:poll_question)
answer = create(:poll_question_answer, question: question)
video_title = "'Magical' by Junko Ohashi"
video_url = "https://www.youtube.com/watch?v=-JMf43st-1A"
visit admin_question_path(question)
within("#poll_question_answer_#{answer.id}") do
click_link "Video list"
end
click_link "Add video"
fill_in "poll_question_answer_video_title", with: video_title
fill_in "poll_question_answer_video_url", with: video_url
click_button "Save"
expect(page).to have_content(video_title)
expect(page).to have_content(video_url)
end
end