]> git.openstreetmap.org Git - rails.git/commitdiff
Test that anonymous note encouragement disappears after login
authorAnton Khorev <tony29@yandex.ru>
Mon, 13 Jan 2025 10:30:57 +0000 (13:30 +0300)
committerAnton Khorev <tony29@yandex.ru>
Mon, 13 Jan 2025 12:03:58 +0000 (15:03 +0300)
test/system/create_note_test.rb

index 04f895219bd4c5751e5eb906087748317d9edbe2..f3a77e5447cd9c3646b02368b1bad04b004ba858 100644 (file)
@@ -79,7 +79,7 @@ class CreateNoteTest < ApplicationSystemTestCase
     end
   end
 
-  test "encouragement to contribute appears after 10 created notes" do
+  test "encouragement to contribute appears after 10 created notes and disappears after login" do
     encouragement_threshold = 10
 
     encouragement_threshold.times do |n|
@@ -100,5 +100,19 @@ class CreateNoteTest < ApplicationSystemTestCase
     within_sidebar do
       assert_content(/already posted at least #{encouragement_threshold} anonymous note/)
     end
+
+    sign_in_as(create(:user))
+    visit new_note_path(:anchor => "map=16/0/#{0.001 * encouragement_threshold}")
+
+    within_sidebar do
+      assert_no_content(/already posted at least \d+ anonymous note/)
+    end
+
+    sign_out
+    visit new_note_path(:anchor => "map=16/0/#{0.001 * encouragement_threshold}")
+
+    within_sidebar do
+      assert_no_content(/already posted at least \d+ anonymous note/)
+    end
   end
 end