Skip to content

Commit

Permalink
Hide link test WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
rbtgr authored and Redmine Patch Meetup committed Feb 5, 2021
1 parent ad85fdc commit 3fd33af
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/views/wiki/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :id => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %>
<%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :id => @page.title}, :class => 'icon icon-move') %>
<% @redirects_to_self.map { |redirect| %>
<!-- TODO: link_to_if_authorized (after test)-->
<%= 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') %>
<% } %>
<%= 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') %>
Expand Down
17 changes: 17 additions & 0 deletions test/functional/wiki_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,23 @@ def test_show_delete_redirect_links
end
end

# TODO:
# def test_hide_delete_redirect_links_without_permission
# # TODO: Create user with edit_wiki_pages permission but without rename_wiki_pages
# @request.session[:user_id] = 2 # user_with_role(role: 'Developer', project: 'ecookbook')
# wiki_page = WikiPage.find_by(title: 'CookBook_documentation')

# new_title = 'New_Cookbook'
# wiki_page.title = new_title
# wiki_page.save

# get :show, :params => {:project_id => 'ecookbook', :id => new_title}

# assert_select '.drdn-items' do
# assert_select 'a.icon-link-break', text: 'Delete redirect from CookBook documentation', count: 0
# end
# end

def test_get_new
@request.session[:user_id] = 2

Expand Down

0 comments on commit 3fd33af

Please sign in to comment.