diff options
Diffstat (limited to 'test/integration/api_test/users_test.rb')
-rw-r--r-- | test/integration/api_test/users_test.rb | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/test/integration/api_test/users_test.rb b/test/integration/api_test/users_test.rb index e1eb7a237..00dc4cc95 100644 --- a/test/integration/api_test/users_test.rb +++ b/test/integration/api_test/users_test.rb @@ -245,26 +245,36 @@ class ApiTest::UsersTest < ActionController::IntegrationTest end end end + end - context "DELETE /users/2" do - context ".xml" do - should "not be allowed" do - assert_no_difference('User.count') do - delete '/users/2.xml' - end - - assert_response :method_not_allowed + context "DELETE /users/2" do + context ".xml" do + should_allow_api_authentication(:delete, + '/users/2.xml', + {}, + {:success_code => :ok}) + + should "delete user" do + assert_difference('User.count', -1) do + delete '/users/2.xml', {}, :authorization => credentials('admin') end + + assert_response :ok end - - context ".json" do - should "not be allowed" do - assert_no_difference('User.count') do - delete '/users/2.json' - end + end + + context ".json" do + should_allow_api_authentication(:delete, + '/users/2.xml', + {}, + {:success_code => :ok}) - assert_response :method_not_allowed + should "delete user" do + assert_difference('User.count', -1) do + delete '/users/2.json', {}, :authorization => credentials('admin') end + + assert_response :ok end end end |