Disable guide page when Budget is not accepting
Why: When there is not Budget accepting (Investment creation) the guide page doesn't have much sense as it will give the user an option that can't be used (creating an Investment). How: Using `Budget.current&.accepting?` conditional at GuidesHelper to link to new proposal link instead of guide page, and adding an scenario to guides feature spec for it.
This commit is contained in:
@@ -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,7 +9,7 @@ module GuidesHelper
|
||||
end
|
||||
|
||||
def new_budget_investment_guide
|
||||
if feature?("guides")
|
||||
if feature?('guides')
|
||||
new_guide_path
|
||||
else
|
||||
new_budget_investment_path(current_budget)
|
||||
|
||||
@@ -13,7 +13,8 @@ feature 'Guide the user to create the correct resource' do
|
||||
Setting['feature.guides'] = nil
|
||||
end
|
||||
|
||||
scenario "Proposal" do
|
||||
context "Proposals" do
|
||||
scenario "Proposal creation" do
|
||||
login_as(user)
|
||||
visit proposals_path
|
||||
|
||||
@@ -23,6 +24,17 @@ feature 'Guide the user to create the correct resource' do
|
||||
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
|
||||
login_as(user)
|
||||
visit budgets_path
|
||||
|
||||
Reference in New Issue
Block a user