We get rid of database cleaner, and JavaScript tests are faster because between tests we now rollback transactions instead of truncating the database.
32 lines
771 B
Ruby
32 lines
771 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
|