diff --git a/app/views/alchemy/admin/tags/_tag.html.erb b/app/views/alchemy/admin/tags/_tag.html.erb index 7cfd951f39..e4a3bfd1f7 100644 --- a/app/views/alchemy/admin/tags/_tag.html.erb +++ b/app/views/alchemy/admin/tags/_tag.html.erb @@ -2,7 +2,7 @@ <%= render_icon(:tag, size: "xl") %> <%= tag.name %> - <% tag.taggings.collect(&:taggable).compact.uniq.each do |taggable| %> + <% tag.taggings.collect(&:taggable).compact.uniq(&:class).each do |taggable| %> <%= taggable.class.model_name.human %> diff --git a/spec/features/admin/tags_integration_spec.rb b/spec/features/admin/tags_integration_spec.rb new file mode 100644 index 0000000000..9156428745 --- /dev/null +++ b/spec/features/admin/tags_integration_spec.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +require "rails_helper" + +RSpec.describe "Tags", type: :system do + let!(:picture) { create(:alchemy_picture, tag_list: "Foo") } + let!(:picture2) { create(:alchemy_picture, tag_list: "Foo") } + let!(:a_page) { create(:alchemy_page, tag_list: "Bar") } + + before { authorize_user(:as_admin) } + + describe "index view" do + it "should list taggable class names" do + visit "/admin/tags" + expect(page).to have_selector(".label", text: "Picture", count: 1) + expect(page).to have_selector(".label", text: "Page", count: 1) + end + end +end