+ def test_comments_invalid_paged
+ user = create(:user)
+
+ %w[-1 0 fred].each do |id|
+ get diary_comments_path(:display_name => user.display_name, :before => id)
+ assert_redirected_to :controller => :errors, :action => :bad_request
+
+ get diary_comments_path(:display_name => user.display_name, :after => id)
+ assert_redirected_to :controller => :errors, :action => :bad_request
+ end
+ end
+
+ def test_subscribe_page
+ user = create(:user)
+ other_user = create(:user)
+ diary_entry = create(:diary_entry, :user => user)
+ path = diary_entry_subscribe_path(user, diary_entry)
+
+ get path
+ assert_redirected_to login_path(:referer => path)
+
+ session_for(other_user)
+ get path
+ assert_response :success
+ assert_dom ".content-body" do
+ assert_dom "a[href='#{diary_entry_path(user, diary_entry)}']", :text => diary_entry.title
+ assert_dom "a[href='#{user_path(user)}']", :text => user.display_name
+ end
+ end
+