Files
grecia/spec/features/guides_spec.rb
rgarcia d3d05f9cee Add guide to create a proposal or investment
During a Participatory Budget, some users are getting confused and
creating a proposal instead of a budget investment. This intermediate
page should help them create investments

Adding a feature flag just in case other forks don’t need this feature
and setting seeds and dev_seeds for appropriate initial setup
2018-01-18 21:09:21 +01:00

54 lines
1.2 KiB
Ruby

require 'rails_helper'
feature 'Guide the user to create the correct resource' do
let(:user) { create(:user, :verified)}
let!(:budget) { create(:budget, :accepting) }
background do
Setting['feature.guides'] = true
end
after do
Setting['feature.guides'] = nil
end
scenario "Proposal" do
login_as(user)
visit proposals_path
click_link "Create a proposal"
click_link "I want to create a proposal"
expect(page).to have_current_path(new_proposal_path)
end
scenario "Budget Investment" do
login_as(user)
visit budgets_path
click_link "Create a budget investment"
click_link "I want to create a budget investment"
expect(page).to have_current_path(new_budget_investment_path(budget))
end
scenario "Feature deactivated" do
Setting['feature.guides'] = nil
login_as(user)
visit proposals_path
click_link "Create a proposal"
expect(page).to_not have_link "I want to create a proposal"
expect(page).to have_current_path(new_proposal_path)
visit budgets_path
click_link "Create a budget investment"
expect(page).to_not have_link "I want to create a new budget investment"
expect(page).to have_current_path(new_budget_investment_path(budget))
end
end