diff --git a/app/views/budgets/investments/_sidebar.html.erb b/app/views/budgets/investments/_sidebar.html.erb
index 292e95d59..2a241300f 100644
--- a/app/views/budgets/investments/_sidebar.html.erb
+++ b/app/views/budgets/investments/_sidebar.html.erb
@@ -2,27 +2,29 @@
<% if can?(:create, Budget::Investment.new(budget: @budget)) %>
<% if current_user && current_user.level_two_or_three_verified? %>
- <%= link_to t("budgets.investments.index.sidebar.create"), new_budget_investment_path, class: "button budget expanded" %>
+ <%= link_to t("budgets.investments.index.sidebar.create"),
+ new_budget_investment_path, class: "button budget expanded" %>
<% else %>
<%= t("budgets.investments.index.sidebar.verified_only",
- verify: link_to(t("budgets.investments.index.sidebar.verify_account"), verification_path)).html_safe %>
+ verify: link_to(t("budgets.investments.index.sidebar.verify_account"),
+ verification_path)).html_safe %>
<% end %>
<% end %>
-<% if @budget.accepting? %>
- <%= render "shared/tag_cloud", taggable: 'budget/investment' %>
- <%= render 'categories' %>
- <%= render 'feasibility_link' %>
-<% end %>
-
+<%= render "shared/tag_cloud", taggable: 'budget/investment' %>
+<%= render 'categories' %>
+<%= render 'feasibility_link' %>
<% if @heading && can?(:show, @ballot) %>
-
+
+
<% if @ballot.investments.by_heading(@heading.id).count > 0 %>
@@ -45,5 +47,7 @@
<% end %>
- <%= t("budgets.investments.index.sidebar.voted_info") %>
+
+ <%= t("budgets.investments.index.sidebar.voted_info") %>
+
<% end %>
diff --git a/spec/features/tags/budget_investments_spec.rb b/spec/features/tags/budget_investments_spec.rb
index f16e9a447..0b22297bf 100644
--- a/spec/features/tags/budget_investments_spec.rb
+++ b/spec/features/tags/budget_investments_spec.rb
@@ -164,72 +164,91 @@ feature 'Tags' do
context 'Tag cloud' do
+ let!(:investment1) { create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente') }
+ let!(:investment2) { create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente') }
+ let!(:investment3) { create(:budget_investment, heading: heading, tag_list: 'Economía') }
+
scenario 'Display user tags' do
- earth = create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente')
- money = create(:budget_investment, heading: heading, tag_list: 'Economía')
+ Budget::PHASES.each do |phase|
+ budget.update(phase: phase)
- visit budget_investments_path(budget, heading_id: heading.id)
+ visit budget_investments_path(budget, heading_id: heading.id)
- within "#tag-cloud" do
- expect(page).to have_content "Medio Ambiente"
- expect(page).to have_content "Economía"
+ within "#tag-cloud" do
+ expect(page).to have_content "Medio Ambiente"
+ expect(page).to have_content "Economía"
+ end
end
end
scenario "Filter by user tags" do
- investment1 = create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente')
- investment2 = create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente')
- investment3 = create(:budget_investment, heading: heading, tag_list: 'Economía')
+ Budget::PHASES.each do |phase|
+ budget.update(phase: phase)
- visit budget_investments_path(budget, heading_id: heading.id)
+ if budget.balloting?
+ [investment1, investment2, investment3].each do |investment|
+ investment.update(selected: true)
+ end
+ end
- within "#tag-cloud" do
- click_link "Medio Ambiente"
+ visit budget_investments_path(budget, heading_id: heading.id)
+
+ within "#tag-cloud" do
+ click_link "Medio Ambiente"
+ end
+
+ expect(page).to have_css ".budget-investment", count: 2
+ expect(page).to have_content investment1.title
+ expect(page).to have_content investment2.title
+ expect(page).to_not have_content investment3.title
end
-
- expect(page).to have_css ".budget-investment", count: 2
- expect(page).to have_content investment1.title
- expect(page).to have_content investment2.title
- expect(page).to_not have_content investment3.title
end
end
context "Categories" do
+ let!(:tag1) { create(:tag, kind: 'category', name: 'Medio Ambiente') }
+ let!(:tag2) { create(:tag, kind: 'category', name: 'Economía') }
+
+ let!(:investment1) { create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente') }
+ let!(:investment2) { create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente') }
+ let!(:investment3) { create(:budget_investment, heading: heading, tag_list: 'Economía') }
+
scenario 'Display category tags' do
- create(:tag, kind: 'category', name: 'Medio Ambiente')
- create(:tag, kind: 'category', name: 'Economía')
+ Budget::PHASES.each do |phase|
+ budget.update(phase: phase)
- earth = create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente')
- money = create(:budget_investment, heading: heading, tag_list: 'Economía')
+ visit budget_investments_path(budget, heading_id: heading.id)
- visit budget_investments_path(budget, heading_id: heading.id)
-
- within "#categories" do
- expect(page).to have_content "Medio Ambiente"
- expect(page).to have_content "Economía"
+ within "#categories" do
+ expect(page).to have_content "Medio Ambiente"
+ expect(page).to have_content "Economía"
+ end
end
end
scenario "Filter by category tags" do
- create(:tag, kind: 'category', name: 'Medio Ambiente')
- create(:tag, kind: 'category', name: 'Economía')
+ Budget::PHASES.each do |phase|
+ budget.update(phase: phase)
- investment1 = create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente')
- investment2 = create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente')
- investment3 = create(:budget_investment, heading: heading, tag_list: 'Economía')
+ if budget.balloting?
+ [investment1, investment2, investment3].each do |investment|
+ investment.update(selected: true)
+ end
+ end
- visit budget_investments_path(budget, heading_id: heading.id, search: 'Economía')
+ visit budget_investments_path(budget, heading_id: heading.id, search: 'Economía')
- within "#categories" do
- click_link "Medio Ambiente"
+ within "#categories" do
+ click_link "Medio Ambiente"
+ end
+
+ expect(page).to have_css ".budget-investment", count: 2
+ expect(page).to have_content investment1.title
+ expect(page).to have_content investment2.title
+ expect(page).to_not have_content investment3.title
end
-
- expect(page).to have_css ".budget-investment", count: 2
- expect(page).to have_content investment1.title
- expect(page).to have_content investment2.title
- expect(page).to_not have_content investment3.title
end
end