1 require "application_system_test_case"
3 class HistoryTest < ApplicationSystemTestCase
6 test "atom link on user's history is not modified" do
8 create(:changeset, :user => user, :num_changes => 1) do |changeset|
9 create(:changeset_tag, :changeset => changeset, :k => "comment", :v => "first-changeset-in-history")
12 visit "#{user_path(user)}/history"
13 changesets = find "div.changesets"
14 changesets.assert_text "first-changeset-in-history"
16 assert_css "link[type='application/atom+xml'][href$='#{user_path(user)}/history/feed']", :visible => false
19 test "have only one list element on user's changesets page" do
21 create_visible_changeset(user, "first-changeset-in-history")
22 create_visible_changeset(user, "bottom-changeset-in-batch-2")
23 (PAGE_SIZE - 1).times do
24 create_visible_changeset(user, "next-changeset")
26 create_visible_changeset(user, "bottom-changeset-in-batch-1")
27 (PAGE_SIZE - 1).times do
28 create_visible_changeset(user, "next-changeset")
31 assert_nothing_raised do
32 visit "#{user_path(user)}/history"
33 changesets = find "div.changesets"
34 changesets.assert_text "bottom-changeset-in-batch-1"
35 changesets.assert_no_text "bottom-changeset-in-batch-2"
36 changesets.assert_no_text "first-changeset-in-history"
37 changesets.assert_selector "ol", :count => 1
38 changesets.assert_selector "li", :count => PAGE_SIZE
40 changesets.find(".changeset_more a.btn").click
41 changesets.assert_text "bottom-changeset-in-batch-1"
42 changesets.assert_text "bottom-changeset-in-batch-2"
43 changesets.assert_no_text "first-changeset-in-history"
44 changesets.assert_selector "ol", :count => 1
45 changesets.assert_selector "li", :count => 2 * PAGE_SIZE
47 changesets.find(".changeset_more a.btn").click
48 changesets.assert_text "bottom-changeset-in-batch-1"
49 changesets.assert_text "bottom-changeset-in-batch-2"
50 changesets.assert_text "first-changeset-in-history"
51 changesets.assert_selector "ol", :count => 1
52 changesets.assert_selector "li", :count => (2 * PAGE_SIZE) + 1
56 def create_visible_changeset(user, comment)
57 create(:changeset, :user => user, :num_changes => 1) do |changeset|
58 create(:changeset_tag, :changeset => changeset, :k => "comment", :v => comment)