]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/diary_entries_controller_test.rb
Use with_settings for temporary changes to settings
[rails.git] / test / controllers / diary_entries_controller_test.rb
index c8aaf64097464d8056719aecc4b8d6cde40ee175..b83e9b7a0e07e96e287514010daf76e930f891d1 100644 (file)
@@ -677,7 +677,7 @@ class DiaryEntriesControllerTest < ActionDispatch::IntegrationTest
     get diary_rss_path
     assert_select "rss>channel>item", :count => 2
 
-    with_diary_feed_delay(6) do
+    with_settings(:diary_feed_delay => 6) do
       get diary_rss_path
       assert_select "rss>channel>item", :count => 1
     end
@@ -695,9 +695,9 @@ class DiaryEntriesControllerTest < ActionDispatch::IntegrationTest
     assert_template :show
 
     # Try a non-integer ID
-    assert_raise ActionController::RoutingError do
-      get "/user/#{CGI.escape(user.display_name)}/diary/#{diary_entry.id})"
-    end
+    get "/user/#{CGI.escape(user.display_name)}/diary/#{diary_entry.id})"
+    assert_response :not_found
+    assert_template "rescues/routing_error"
 
     # Try a deleted entry
     diary_entry_deleted = create(:diary_entry, :user => user, :visible => false)
@@ -1003,13 +1003,4 @@ class DiaryEntriesControllerTest < ActionDispatch::IntegrationTest
       assert_select "a[href=?]", "/user/#{ERB::Util.u(entry.user.display_name)}/diary/#{entry.id}"
     end
   end
-
-  def with_diary_feed_delay(value)
-    diary_feed_delay = Settings.diary_feed_delay
-    Settings.diary_feed_delay = value
-
-    yield
-
-    Settings.diary_feed_delay = diary_feed_delay
-  end
 end