aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/track_controller.rb1
-rw-r--r--spec/controllers/track_controller_spec.rb5
2 files changed, 6 insertions, 0 deletions
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb
index e39a0489d..d858ab233 100644
--- a/app/controllers/track_controller.rb
+++ b/app/controllers/track_controller.rb
@@ -66,6 +66,7 @@ class TrackController < ApplicationController
# Track a user
def track_user
@track_user = User.find_by_url_name(params[:url_name])
+ raise ActiveRecord::RecordNotFound.new("No such user") if @track_user.nil?
@track_thing = TrackThing.create_track_for_user(@track_user)
return atom_feed_internal if params[:feed] == 'feed'
diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb
index ee974dedd..0dc5db607 100644
--- a/spec/controllers/track_controller_spec.rb
+++ b/spec/controllers/track_controller_spec.rb
@@ -134,6 +134,11 @@ describe TrackController, "when viewing RSS feed for a track" do
assigns[:xapian_object].results[2][:model].should == info_request_events(:useless_outgoing_message_event) # created_at 2007-10-14 10:41:12.686264
end
+ it "should return NotFound for a non-existent user" do
+ lambda {
+ get :track_user, :feed => 'feed', :url_name => "there_is_no_such_user"
+ }.should raise_error(ActiveRecord::RecordNotFound)
+ end
end
describe TrackController, "when viewing JSON version of a track feed" do