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 visit "#{user_path(user)}/history"
32 changesets = find "div.changesets"
33 changesets.assert_text "bottom-changeset-in-batch-1"
34 changesets.assert_no_text "bottom-changeset-in-batch-2"
35 changesets.assert_no_text "first-changeset-in-history"
36 changesets.assert_selector "ol", :count => 1
37 changesets.assert_selector "li", :count => PAGE_SIZE
39 changesets.find(".changeset_more a.btn").click
40 changesets.assert_text "bottom-changeset-in-batch-1"
41 changesets.assert_text "bottom-changeset-in-batch-2"
42 changesets.assert_no_text "first-changeset-in-history"
43 changesets.assert_selector "ol", :count => 1
44 changesets.assert_selector "li", :count => 2 * PAGE_SIZE
46 changesets.find(".changeset_more a.btn").click
47 changesets.assert_text "bottom-changeset-in-batch-1"
48 changesets.assert_text "bottom-changeset-in-batch-2"
49 changesets.assert_text "first-changeset-in-history"
50 changesets.assert_selector "ol", :count => 1
51 changesets.assert_selector "li", :count => (2 * PAGE_SIZE) + 1
54 def create_visible_changeset(user, comment)
55 create(:changeset, :user => user, :num_changes => 1) do |changeset|
56 create(:changeset_tag, :changeset => changeset, :k => "comment", :v => comment)