Fix stack level too deep bug when deleting questions with answers

This commit is contained in:
Amaia Castro
2017-01-02 19:51:39 +01:00
parent 3de48353da
commit 98b6dd75ea
3 changed files with 52 additions and 2 deletions

View File

@@ -86,4 +86,22 @@ feature 'Admin legislation questions' do
expect(page).to have_content 'Question 2b'
end
end
context 'Delete' do
scenario 'Legislation question', :js do
process = create(:legislation_process, title: 'An example legislation process')
create(:legislation_question, title: 'Question 1', process: process)
question = create(:legislation_question, title: 'Question 2', process: process)
question_option = create(:legislation_question_option, question: question, value: 'Yes')
create(:legislation_answer, question: question, question_option: question_option)
visit edit_admin_legislation_process_question_path(process, question)
click_link 'Delete'
expect(page).to have_content 'Questions'
expect(page).to have_content 'Question 1'
expect(page).to_not have_content 'Question 2'
end
end
end