Files
nairobi/spec/system/admin/poll/questions/answers/documents/documents_spec.rb
Javi Martín 9427f01442 Use system specs instead of feature specs
We get rid of database cleaner, and JavaScript tests are faster because
between tests we now rollback transactions instead of truncating the
database.
2020-04-24 15:43:54 +02:00

41 lines
994 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