Allow to delete answers if the poll has not started yet
Deleting answers was not even possible. But it was possible to delete questions. So we implemented the same behavior.
This commit is contained in:
committed by
Javi Martín
parent
3a6e99cb8c
commit
14542df0de
@@ -71,6 +71,21 @@ describe "Answers", :admin do
|
||||
expect("Another title").to appear_before("New title")
|
||||
end
|
||||
|
||||
scenario "Destroy" do
|
||||
answer = create(:poll_question_answer, poll: future_poll, title: "I'm not useful")
|
||||
|
||||
visit admin_question_path(answer.question)
|
||||
|
||||
within("tr", text: "I'm not useful") do
|
||||
accept_confirm("Are you sure? This action will delete \"I'm not useful\" and can't be undone.") do
|
||||
click_button "Delete"
|
||||
end
|
||||
end
|
||||
|
||||
expect(page).to have_content "Answer deleted successfully"
|
||||
expect(page).not_to have_content "I'm not useful"
|
||||
end
|
||||
|
||||
scenario "Reorder" do
|
||||
question = create(:poll_question)
|
||||
create(:poll_question_answer, question: question, title: "First", given_order: 1)
|
||||
|
||||
Reference in New Issue
Block a user