]> git.openstreetmap.org Git - rails.git/blob - test/system/redaction_destroy_test.rb
Merge branch 'pull/5209'
[rails.git] / test / system / redaction_destroy_test.rb
1 require "application_system_test_case"
2
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)
7
8     sign_in_as create(:moderator_user)
9     visit redaction_path(redaction)
10     assert_text "Some-unwanted-data-redaction"
11
12     accept_alert do
13       click_on "Remove this redaction"
14     end
15     assert_text "Redaction is not empty"
16     assert_text "Some-unwanted-data-redaction"
17   end
18
19   test "deletes empty redaction" do
20     redaction = create(:redaction, :title => "No-unwanted-data-redaction")
21
22     sign_in_as create(:moderator_user)
23     visit redaction_path(redaction)
24     assert_text "No-unwanted-data-redaction"
25
26     accept_alert do
27       click_on "Remove this redaction"
28     end
29     assert_text "Redaction destroyed"
30     assert_text "List of Redactions"
31     assert_no_text "No-unwanted-data-redaction"
32   end
33 end