Files
nairobi/spec/features/admin/poll/questions/answers/documents/documents_spec.rb
Javi Martín b0d1d00916 Fix modal text warning in answers documents spec
It looks like we get this warning if we check the dialog message. Using
`accept_confirm` the same way we do in the rest of the application
solves the problem.
2019-10-23 17:46:47 +02:00

43 lines
996 B
Ruby

require "rails_helper"
describe "Documents" do
before do
admin = create(:administrator)
login_as(admin.user)
end
context "Index" do
scenario "Answer with no documents" do
answer = create(:poll_question_answer)
document = create(:document)
visit admin_answer_documents_path(answer)
expect(page).not_to have_content(document.title)
end
scenario "Answer with documents" do
answer = create(:poll_question_answer)
document = create(:document, documentable: answer)
visit admin_answer_documents_path(answer)
expect(page).to have_content(document.title)
end
end
scenario "Remove document from answer", :js do
answer = create(:poll_question_answer)
document = create(:document, documentable: answer)
visit admin_answer_documents_path(answer)
expect(page).to have_content(document.title)
accept_confirm { click_link "Delete" }
expect(page).not_to have_content(document.title)
end
end