1 require "application_system_test_case"
3 class RedactionDestroyTest < ApplicationSystemTestCase
4 test "fails to delete nonempty redaction" do
5 redaction = create(:redaction, :title => "Some-unwanted-data-redaction")
6 create(:old_node, :redaction => redaction)
8 sign_in_as create(:moderator_user)
9 visit redaction_path(redaction)
10 assert_text "Some-unwanted-data-redaction"
13 click_on "Remove this redaction"
15 assert_text "Redaction is not empty"
16 assert_text "Some-unwanted-data-redaction"
19 test "deletes empty redaction" do
20 redaction = create(:redaction, :title => "No-unwanted-data-redaction")
22 sign_in_as create(:moderator_user)
23 visit redaction_path(redaction)
24 assert_text "No-unwanted-data-redaction"
27 click_on "Remove this redaction"
29 assert_text "Redaction destroyed"
30 assert_text "List of Redactions"
31 assert_no_text "No-unwanted-data-redaction"