X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/feb7af2020c488cdcb03ec11d88e9a44625c912f..fe214adbc6c35ee9f8edb492b1487981a46f7e30:/test/system/create_note_test.rb?ds=sidebyside diff --git a/test/system/create_note_test.rb b/test/system/create_note_test.rb index 5688ec376..f3a77e544 100644 --- a/test/system/create_note_test.rb +++ b/test/system/create_note_test.rb @@ -78,4 +78,41 @@ class CreateNoteTest < ApplicationSystemTestCase end end end + + test "encouragement to contribute appears after 10 created notes and disappears after login" do + encouragement_threshold = 10 + + encouragement_threshold.times do |n| + visit new_note_path(:anchor => "map=16/0/#{0.001 * n}") + + within_sidebar do + assert_no_content(/already posted at least \d+ anonymous note/) + + fill_in "text", :with => "new note ##{n + 1}" + click_on "Add Note" + + assert_content "new note ##{n + 1}" + end + end + + visit new_note_path(:anchor => "map=16/0/#{0.001 * encouragement_threshold}") + + 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