]> git.openstreetmap.org Git - rails.git/blob - test/system/user_notes_test.rb
Merge remote-tracking branch 'upstream/pull/6316'
[rails.git] / test / system / user_notes_test.rb
1 require "application_system_test_case"
2
3 class UserNotesTest < ApplicationSystemTestCase
4   test "boundary condition when next page link activates" do
5     user = create(:user)
6     ("A".."J").each do |x|
7       create(:note, :author => user, :description => "Note '#{x}'") do |note|
8         create(:note_comment, :event => "opened", :note => note, :author => user, :body => "Note '#{x}'")
9       end
10     end
11
12     visit user_notes_path(user)
13
14     within_content_body do
15       assert_text "Note 'J'"
16       assert_text "Note 'A'"
17       assert_no_link "Previous"
18       assert_no_link "Next"
19     end
20
21     ("K".."K").each do |x|
22       create(:note, :author => user, :description => "Note '#{x}'") do |note|
23         create(:note_comment, :event => "opened", :note => note, :author => user, :body => "Note '#{x}'")
24       end
25     end
26
27     visit user_notes_path(user)
28
29     within_content_body do
30       assert_text "Note 'K'"
31       assert_text "Note 'B'"
32       assert_no_text "Note 'A'"
33       assert_no_link "Previous"
34       assert_link "Next"
35
36       click_on "Next", :match => :first
37
38       assert_no_text "Note 'K'"
39       assert_no_text "Note 'B'"
40       assert_text "Note 'A'"
41       assert_link "Previous"
42       assert_no_link "Next"
43     end
44   end
45 end