X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/e2cb2327f9e5a3a107dbe249e4fe503cbde45d24..f138055849e5b09cd94797c3e1705c6357d6b93b:/test/controllers/diary_entries_controller_test.rb diff --git a/test/controllers/diary_entries_controller_test.rb b/test/controllers/diary_entries_controller_test.rb index 6365d46e5..b505d9cdb 100644 --- a/test/controllers/diary_entries_controller_test.rb +++ b/test/controllers/diary_entries_controller_test.rb @@ -164,7 +164,7 @@ class DiaryEntriesControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_template :new - assert_nil UserPreference.where(:user_id => user.id, :k => "diary.default_language").first + assert_nil UserPreference.where(:user => user, :k => "diary.default_language").first end def test_create @@ -189,7 +189,7 @@ class DiaryEntriesControllerTest < ActionDispatch::IntegrationTest # checks if user was subscribed assert_equal 1, entry.subscribers.length - assert_equal "en", UserPreference.where(:user_id => user.id, :k => "diary.default_language").first.v + assert_equal "en", UserPreference.where(:user => user, :k => "diary.default_language").first.v end def test_create_german @@ -216,7 +216,7 @@ class DiaryEntriesControllerTest < ActionDispatch::IntegrationTest # checks if user was subscribed assert_equal 1, entry.subscribers.length - assert_equal "de", UserPreference.where(:user_id => user.id, :k => "diary.default_language").first.v + assert_equal "de", UserPreference.where(:user => user, :k => "diary.default_language").first.v end def test_new_spammy @@ -568,28 +568,28 @@ class DiaryEntriesControllerTest < ActionDispatch::IntegrationTest assert_select "li.page-item.disabled span.page-link", :text => "Newer Entries", :count => 1 # Try and get the second page - get css_select("li.page-item a.page-link").first["href"] + get css_select("li.page-item .page-link").last["href"] assert_response :success assert_select "article.diary_post", :count => 20 assert_select "li.page-item a.page-link", :text => "Older Entries", :count => 1 assert_select "li.page-item a.page-link", :text => "Newer Entries", :count => 1 # Try and get the third page - get css_select("li.page-item a.page-link").first["href"] + get css_select("li.page-item .page-link").last["href"] assert_response :success assert_select "article.diary_post", :count => 10 assert_select "li.page-item.disabled span.page-link", :text => "Older Entries", :count => 1 assert_select "li.page-item a.page-link", :text => "Newer Entries", :count => 1 # Go back to the second page - get css_select("li.page-item a.page-link").last["href"] + get css_select("li.page-item .page-link").first["href"] assert_response :success assert_select "article.diary_post", :count => 20 assert_select "li.page-item a.page-link", :text => "Older Entries", :count => 1 assert_select "li.page-item a.page-link", :text => "Newer Entries", :count => 1 # Go back to the first page - get css_select("li.page-item a.page-link").last["href"] + get css_select("li.page-item .page-link").first["href"] assert_response :success assert_select "article.diary_post", :count => 20 assert_select "li.page-item a.page-link", :text => "Older Entries", :count => 1