diff --git a/spec/features/admin/poll/questions/answers/answers_spec.rb b/spec/features/admin/poll/questions/answers/answers_spec.rb index 9ffcab470..a2d0c78bc 100644 --- a/spec/features/admin/poll/questions/answers/answers_spec.rb +++ b/spec/features/admin/poll/questions/answers/answers_spec.rb @@ -9,36 +9,32 @@ describe "Answers" do scenario "Create" do question = create(:poll_question) - title = "Whatever the question may be, the answer is always 42" - description = "The Hitchhiker's Guide To The Universe" visit admin_question_path(question) click_link "Add answer" - fill_in "Answer", with: title - fill_in "Description", with: description + fill_in "Answer", with: "The answer is always 42" + fill_in "Description", with: "The Hitchhiker's Guide To The Universe" click_button "Save" - expect(page).to have_content(title) - expect(page).to have_content(description) + expect(page).to have_content "The answer is always 42" + expect(page).to have_content "The Hitchhiker's Guide To The Universe" end scenario "Create second answer and place after the first one" do question = create(:poll_question) answer = create(:poll_question_answer, title: "First", question: question, given_order: 1) - title = "Second" - description = "Description" visit admin_question_path(question) click_link "Add answer" - fill_in "Answer", with: title - fill_in "Description", with: description + fill_in "Answer", with: "Second" + fill_in "Description", with: "Description" click_button "Save" - expect(page.body.index("First")).to be < page.body.index("Second") + expect("First").to appear_before("Second") end scenario "Update" do @@ -50,22 +46,18 @@ describe "Answers" do click_link "Edit answer" - old_title = answer.title - new_title = "Ex Machina" - - fill_in "Answer", with: new_title + fill_in "Answer", with: "New title" click_button "Save" - expect(page).to have_content("Changes saved") - expect(page).to have_content(new_title) + expect(page).to have_content "Changes saved" + expect(page).to have_content "New title" visit admin_question_path(question) - expect(page).to have_content(new_title) - expect(page).not_to have_content(old_title) + expect(page).not_to have_content "Answer title" - expect(answer2.title).to appear_before(new_title) + expect("Another title").to appear_before("New title") end end