File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -177,9 +177,23 @@ class AdminControllerTest < ActionController::TestCase
177177 assert BlockedItem . where ( item_type : 'email' , value : user . email ) . any?
178178 end
179179
180+ test 'impersonate should bypass reason in dev env' do
181+ sign_in users ( :developer )
182+
183+ Rails . env . stub ( :development? , true ) do
184+ try_impersonate_user ( users ( :standard_user ) )
185+ assert_response ( :found )
186+ assert_redirected_to root_path
187+ end
188+ end
189+
180190 private
181191
182192 def try_hellban_user ( user )
183193 post :hellban , params : { id : user . id }
184194 end
195+
196+ def try_impersonate_user ( user )
197+ get :impersonate , params : { id : user . id }
198+ end
185199end
Original file line number Diff line number Diff line change @@ -61,6 +61,13 @@ sample_global_admin:
6161 is_moderator : false
6262 reputation : 1
6363
64+ sample_developer :
65+ user : developer
66+ community : sample
67+ is_admin : true
68+ is_moderator : false
69+ reputation : 1
70+
6471sample_staff :
6572 user : staff
6673 community : sample
You can’t perform that action at this time.
0 commit comments