Skip to content

Commit d5ebf1c

Browse files
committed
Hide link test WIP
1 parent 646126b commit d5ebf1c

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

app/views/wiki/show.html.erb

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :id => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %>
1717
<%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :id => @page.title}, :class => 'icon icon-move') %>
1818
<% @redirects_to_self.map { |redirect| %>
19+
<!-- TODO: link_to_if_authorized (after test)-->
1920
<%= link_to("Delete redirect from #{WikiPage.pretty_title(redirect.title)}", {:controller => 'wiki_redirects', :action => 'destroy', :project_id => @project.identifier, :wiki_page_id => @page.title, :id => redirect.id}, :method => :delete, :class => 'icon icon-link-break') %>
2021
<% } %>
2122
<%= link_to_if_authorized(l(:button_delete), {:action => 'destroy', :id => @page.title}, :method => :delete, :data => {:confirm => l(:text_are_you_sure)}, :class => 'icon icon-del') %>

test/functional/wiki_controller_test.rb

+17
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,23 @@ def test_show_delete_redirect_links
213213
end
214214
end
215215

216+
# TODO:
217+
# def test_hide_delete_redirect_links_without_permission
218+
# # TODO: Create user with edit_wiki_pages permission but without rename_wiki_pages
219+
# @request.session[:user_id] = 2 # user_with_role(role: 'Developer', project: 'ecookbook')
220+
# wiki_page = WikiPage.find_by(title: 'CookBook_documentation')
221+
222+
# new_title = 'New_Cookbook'
223+
# wiki_page.title = new_title
224+
# wiki_page.save
225+
226+
# get :show, :params => {:project_id => 'ecookbook', :id => new_title}
227+
228+
# assert_select '.drdn-items' do
229+
# assert_select 'a.icon-link-break', text: 'Delete redirect from CookBook documentation', count: 0
230+
# end
231+
# end
232+
216233
def test_get_new
217234
@request.session[:user_id] = 2
218235

0 commit comments

Comments
 (0)