Files
nairobi/spec/features/admin/poll/questions/answers/documents/documents_spec.rb
Javi Martín f5849cb5d8 Remove unnecessary question creating answers
Questions are automatically created by the poll_question_answer factory.
2019-09-24 19:55:42 +02:00

45 lines
1.0 KiB
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 "Are you sure?" do
click_link "Delete"
end
expect(page).not_to have_content(document.title)
end
end