Change test case

This commit is contained in:
biswesh456 2018-03-03 20:20:52 +05:30
parent 646dcb62fc
commit 674589ce2c
2 changed files with 7 additions and 3 deletions

View file

@ -192,7 +192,11 @@ class TraceController < ApplicationController
trace.visible = false trace.visible = false
trace.save trace.save
flash[:notice] = t "trace.delete.scheduled_for_deletion" 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 end
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
head :not_found head :not_found

View file

@ -690,9 +690,9 @@ class TraceControllerTest < ActionController::TestCase
public_trace_file = create(:trace, :visibility => "public") public_trace_file = create(:trace, :visibility => "public")
admin = create(:administrator_user) 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_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) trace = Trace.find(public_trace_file.id)
assert_equal false, trace.visible assert_equal false, trace.visible
end end