]> git.openstreetmap.org Git - rails.git/commitdiff
Change test case
authorbiswesh456 <biswesh.mohapatra@iiitb.org>
Sat, 3 Mar 2018 14:50:52 +0000 (20:20 +0530)
committerbiswesh456 <biswesh.mohapatra@iiitb.org>
Sat, 3 Mar 2018 14:50:52 +0000 (20:20 +0530)
app/controllers/trace_controller.rb
test/controllers/trace_controller_test.rb

index 81c7864738cf3d5208a1566f23c7a2a86becd9fd..5dd49c6be704edf8400663be9712d574308aa01d 100644 (file)
@@ -192,7 +192,11 @@ class TraceController < ApplicationController
       trace.visible = false
       trace.save
       flash[:notice] = t "trace.delete.scheduled_for_deletion"
-      redirect_to :action => :list, :display_name => current_user.display_name
+      if current_user.administrator? || current_user.moderator?
+        redirect_to :action => :list, :display_name => trace.user.display_name
+      else
+        redirect_to :action => :list, :display_name => current_user.display_name
+      end
     end
   rescue ActiveRecord::RecordNotFound
     head :not_found
index a9008bc972886fefc3474ee5ab73225879654414..23a2e5261755063f705fab8bcaf103afc26bcd11 100644 (file)
@@ -690,9 +690,9 @@ class TraceControllerTest < ActionController::TestCase
     public_trace_file = create(:trace, :visibility => "public")
     admin = create(:administrator_user)
 
-    post :delete, :params => { :display_name => admin.display_name, :id => public_trace_file.id }, :session => { :user => admin }
+    post :delete, :params => { :display_name => public_trace_file.user.display_name, :id => public_trace_file.id }, :session => { :user => admin }
     assert_response :redirect
-    assert_redirected_to :action => :list, :display_name => admin.display_name
+    assert_redirected_to :action => :list, :display_name => public_trace_file.user.display_name
     trace = Trace.find(public_trace_file.id)
     assert_equal false, trace.visible
   end