diff options
author | azul <azul@leap.se> | 2014-07-09 13:25:31 +0200 |
---|---|---|
committer | azul <azul@leap.se> | 2014-07-09 13:25:31 +0200 |
commit | dc740e4311101bf7297996788b25a99edafbe759 (patch) | |
tree | d989456179551fb167f6c41ba4b54bbd4a77a7ac /test/functional/identities_controller_test.rb | |
parent | 19da5429308412c19176733d2b32ccbf2c08df1c (diff) | |
parent | 0cc11ebb609de225fbeacbf80788b992b88b6ce6 (diff) |
Merge pull request #173 from azul/feature/unblock-handles
Allow admins to unblock handles
Diffstat (limited to 'test/functional/identities_controller_test.rb')
-rw-r--r-- | test/functional/identities_controller_test.rb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/test/functional/identities_controller_test.rb b/test/functional/identities_controller_test.rb new file mode 100644 index 0000000..fcdeaa2 --- /dev/null +++ b/test/functional/identities_controller_test.rb @@ -0,0 +1,42 @@ +require 'test_helper' + +class IdentitiesControllerTest < ActionController::TestCase + + test "admin can list active and blocked ids" do + login :is_admin? => true + get :index + assert_response :success + assert ids = assigns(:identities) + end + + test "non-admin can't list usernames" do + login + get :index + assert_access_denied + end + + test "requires login" do + get :index + assert_login_required + end + + test "admin can unblock username" do + # an identity without user_id and destination is a blocked handle + identity = FactoryGirl.create :identity + login :is_admin? => true + delete :destroy, id: identity.id + assert_response :redirect + assert_nil Identity.find(identity.id) + end + + test "admin cannot remove main identity" do + user = FactoryGirl.create :user + identity = FactoryGirl.create :identity, + Identity.attributes_from_user(user) + login :is_admin? => true + delete :destroy, id: identity.id + assert_response :redirect + assert_equal identity, Identity.find(identity.id) + end + +end |