Files
nairobi/spec/features/admin/poll/questions/answers/videos/videos_spec.rb
Javi Martín 307cf24846 Use describe on feature tests
The `type: :feature` is automatically detected by RSpec because these
tests are inside the `spec/features` folder. Using `feature` re-adds a
`type: :feature` to these files, which will result in a conflict when we
upgrade to Rails 5.1's system tests.

Because of this change, we also need to change `background` to `before`
or else these tests will fail.
2019-05-28 16:36:54 +02:00

34 lines
773 B
Ruby

require "rails_helper"
describe "Videos" do
before do
admin = create(:administrator)
login_as(admin.user)
end
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