diff options
author | jessib <jessib@riseup.net> | 2013-11-25 11:31:33 -0800 |
---|---|---|
committer | jessib <jessib@riseup.net> | 2013-11-25 11:31:33 -0800 |
commit | 299dfdf4164ee10de63aa2543935eeed65437b3f (patch) | |
tree | 13f878e171d1cbbbcc82f5e40c91db145017efb2 /users/test | |
parent | d82ea5da2aa705bcfa74f2a8b42a197883b694e3 (diff) |
Give 404 error if one goes to /key/user for non-existing user.
Diffstat (limited to 'users/test')
-rw-r--r-- | users/test/functional/keys_controller_test.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/users/test/functional/keys_controller_test.rb b/users/test/functional/keys_controller_test.rb index 9cc88d1..b69cbc0 100644 --- a/users/test/functional/keys_controller_test.rb +++ b/users/test/functional/keys_controller_test.rb @@ -13,6 +13,7 @@ class KeysControllerTest < ActionController::TestCase end test "get non-existing public key for user" do + # this isn't a scenerio that should generally occur. @user = stub_record :user User.stubs(:find_by_login).with(@user.login).returns(@user) get :show, :login => @user.login @@ -22,10 +23,10 @@ class KeysControllerTest < ActionController::TestCase end test "get public key for non-existing user" do - get :show, :login => 'asdkljslksjfdlskfj' - assert_response :success - assert_equal "text/html", response.content_type - assert_equal '', response.body.strip + # raise 404 error if user doesn't exist (doesn't need to be this routing error, but seems fine to assume for now): + assert_raise(ActionController::RoutingError) { + get :show, :login => 'asdkljslksjfdlskfj' + } end end |