artists: add test for hiding deleted wikis on artist pages (#4526).
This commit is contained in:
@@ -8,12 +8,14 @@
|
|||||||
<% if @artist.is_banned? && !policy(@artist).can_view_banned? %>
|
<% if @artist.is_banned? && !policy(@artist).can_view_banned? %>
|
||||||
<p>The artist requested removal of this page.</p>
|
<p>The artist requested removal of this page.</p>
|
||||||
<% else %>
|
<% else %>
|
||||||
<% if @artist.wiki_page.present? && !@artist.wiki_page.is_deleted %>
|
<% if @artist.wiki_page.present? && !@artist.wiki_page.is_deleted? %>
|
||||||
<div class="prose">
|
<div class="artist-wiki">
|
||||||
<%= format_text(@artist.wiki_page.body, :disable_mentions => true) %>
|
<div class="prose">
|
||||||
</div>
|
<%= format_text(@artist.wiki_page.body, :disable_mentions => true) %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p><%= link_to "View wiki page", @artist.wiki_page %></p>
|
<p><%= link_to "View wiki page", @artist.wiki_page %></p>
|
||||||
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= yield %>
|
<%= yield %>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
<%= format_text(@wiki_page.body) %>
|
<%= format_text(@wiki_page.body) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @wiki_page.artist.present? && !@wiki_page.artist.is_deleted %>
|
<% if @wiki_page.artist.present? && !@wiki_page.artist.is_deleted? %>
|
||||||
<p><%= link_to "View artist", @wiki_page.artist %></p>
|
<p><%= link_to "View artist", @wiki_page.artist %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,22 @@ class ArtistsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
get artist_path(@artist.id)
|
get artist_path(@artist.id)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "show active wikis" do
|
||||||
|
as(@user) { create(:wiki_page, title: @artist.name) }
|
||||||
|
get artist_path(@artist.id)
|
||||||
|
|
||||||
|
assert_response :success
|
||||||
|
assert_select ".artist-wiki", count: 1
|
||||||
|
end
|
||||||
|
|
||||||
|
should "not show deleted wikis" do
|
||||||
|
as(@user) { create(:wiki_page, title: @artist.name, is_deleted: true) }
|
||||||
|
get artist_path(@artist.id)
|
||||||
|
|
||||||
|
assert_response :success
|
||||||
|
assert_select ".artist-wiki", count: 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "new action" do
|
context "new action" do
|
||||||
|
|||||||
Reference in New Issue
Block a user