diff --git a/app/helpers/guides_helper.rb b/app/helpers/guides_helper.rb index 67658f52a..dd504d7d6 100644 --- a/app/helpers/guides_helper.rb +++ b/app/helpers/guides_helper.rb @@ -1,7 +1,7 @@ module GuidesHelper def new_proposal_guide - if feature?("guides") + if feature?('guides') && Budget.current&.accepting? new_guide_path else new_proposal_path @@ -9,11 +9,11 @@ module GuidesHelper end def new_budget_investment_guide - if feature?("guides") + if feature?('guides') new_guide_path else new_budget_investment_path(current_budget) end end -end \ No newline at end of file +end diff --git a/spec/features/guides_spec.rb b/spec/features/guides_spec.rb index 438c5abf7..e03d69c92 100644 --- a/spec/features/guides_spec.rb +++ b/spec/features/guides_spec.rb @@ -13,14 +13,26 @@ feature 'Guide the user to create the correct resource' do Setting['feature.guides'] = nil end - scenario "Proposal" do - login_as(user) - visit proposals_path + context "Proposals" do + scenario "Proposal creation" do + login_as(user) + visit proposals_path - click_link "Create a proposal" - click_link "I want to create a proposal" + click_link "Create a proposal" + click_link "I want to create a proposal" - expect(page).to have_current_path(new_proposal_path) + expect(page).to have_current_path(new_proposal_path) + end + + scenario "Proposal creation when Budget is not accepting" do + budget.update_attribute(:phase, :reviewing) + login_as(user) + visit proposals_path + + click_link "Create a proposal" + + expect(page).to have_current_path(new_proposal_path) + end end scenario "Budget Investment" do @@ -51,4 +63,4 @@ feature 'Guide the user to create the correct resource' do expect(page).to have_current_path(new_budget_investment_path(budget)) end -end \ No newline at end of file +end