Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
laurajaime committed Nov 14, 2024
1 parent ffe90eb commit 7db70a1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ GIT
PATH
remote: .
specs:
decidim-challenges (0.4.1.1)
decidim-challenges (0.4.2)
decidim-core (~> 0.27)

GEM
Expand Down Expand Up @@ -270,7 +270,7 @@ GEM
parser (>= 2.4)
smart_properties
bindex (0.8.1)
bootsnap (1.17.0)
bootsnap (1.18.4)
msgpack (~> 1.2)
browser (2.7.1)
builder (3.2.4)
Expand Down Expand Up @@ -501,7 +501,7 @@ GEM
tomlrb
mixlib-shellout (3.2.7)
chef-utils
msgpack (1.7.2)
msgpack (1.7.5)
multi_xml (0.6.0)
mustache (1.1.1)
net-imap (0.4.9)
Expand Down
6 changes: 5 additions & 1 deletion app/controllers/decidim/challenges/challenges_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ChallengesController < Decidim::Challenges::ApplicationController
helper Decidim::Sdgs::SdgsHelper
helper Decidim::ShowFiltersHelper

helper_method :challenges, :new_solution_path
helper_method :challenges, :new_solution_path, :solutions_component

def index
@challenges = search.result
Expand Down Expand Up @@ -61,6 +61,10 @@ def new_solution_path
component = current_participatory_space.components.find_by(manifest_name: "solutions")
Decidim::EngineRouter.main_proxy(component).new_solution_path
end

def solutions_component
current_participatory_space.components.find_by(manifest_name: "solutions")
end
end
end
end
2 changes: 1 addition & 1 deletion app/views/decidim/challenges/challenges/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<%= link_to t('surveys.answer', scope: "decidim.challenges"), answer_challenge_survey_path(@challenge), class: "card__button button button--sc small" %>
<% end %>
<% if current_participatory_space.components.find_by(manifest_name: "solutions").settings.creation_enabled %>
<% if solutions_component.settings.creation_enabled %>
<%= action_authorized_link_to :create, new_solution_path, class: "card__button button button--sc small", data: { "redirect_url": new_solution_path } do %>
<%= t(".new_solution") %>
<%= icon "plus", role: "img", "aria-hidden": true %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ def visit_challenge
end
end

context "when there are a solution component" do
let(:problems_component) { create(:problems_component, participatory_space: challenge.participatory_space) }
let!(:problem) { create :problem, component: problems_component }
context "when there is a solution component" do
let(:solutions_component) { create(:solutions_component, participatory_space: challenge.participatory_space) }
let!(:solution) { create :solution, component: solutions_component }
let!(:current_participatory_space) { challenge.participatory_space }

before do
solutions_component.update!(
creation_enabled: creation_enabled,
creation_enabled: true,
)
end

Expand Down

0 comments on commit 7db70a1

Please sign in to comment.