Add tag list component to proposal feed

This commit is contained in:
taitus
2021-01-30 11:53:03 +01:00
parent edbef4fd88
commit ca36dd56f0
2 changed files with 26 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
<%= "medium-6 large-9" if proposal.image.present? %>">
<strong><%= link_to proposal.title, url_for(proposal) %></strong><br>
<p><%= proposal.summary %></p>
<%= render SDG::TagListComponent.new(proposal, limit: 5) %>
</div>
<% if proposal.image.present? %>

View File

@@ -0,0 +1,25 @@
require "rails_helper"
describe Widget::Feeds::ProposalComponent, type: :component do
let(:proposal) { create(:proposal, sdg_goals: [SDG::Goal[1]]) }
let(:component) { Widget::Feeds::ProposalComponent.new(proposal) }
before do
Setting["feature.sdg"] = true
Setting["sdg.process.proposals"] = true
end
it "renders a title with link" do
render_inline component
expect(page).to have_link proposal.title, href: "/proposals/#{proposal.to_param}"
end
it "renders a tag list" do
render_inline component
expect(page).to have_link "1. No Poverty",
title: "See all Citizen proposals related to goal 1",
href: "/proposals?advanced_search#{CGI.escape("[goal]")}=1"
end
end