From 1abb7f031039a16c3b7389d49b71d2d8be8c34a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Thu, 18 Jan 2018 21:32:58 +0100 Subject: [PATCH 1/6] Added admin budget phases controller and routes --- .../admin/budget_phases_controller.rb | 26 +++++++++++++++++++ app/models/budget/phase.rb | 2 ++ config/routes/admin.rb | 2 ++ 3 files changed, 30 insertions(+) create mode 100644 app/controllers/admin/budget_phases_controller.rb diff --git a/app/controllers/admin/budget_phases_controller.rb b/app/controllers/admin/budget_phases_controller.rb new file mode 100644 index 000000000..f63ccdb4d --- /dev/null +++ b/app/controllers/admin/budget_phases_controller.rb @@ -0,0 +1,26 @@ +class Admin::BudgetPhasesController < Admin::BaseController + + before_action :load_phase, only: [:edit, :update] + + def edit; end + + def update + if @phase.update(budget_phase_params) + redirect_to edit_admin_budget_path(@phase.budget), notice: t("flash.actions.save_changes.notice") + else + render :edit + end + end + + private + + def load_phase + @phase = Budget::Phase.find(params[:id]) + end + + def budget_phase_params + valid_attributes = [:starts_at, :ends_at, :summary, :description, :enabled] + params.require(:budget_phase).permit(*valid_attributes) + end + +end diff --git a/app/models/budget/phase.rb b/app/models/budget/phase.rb index 5475d97be..ca4ad6f0d 100644 --- a/app/models/budget/phase.rb +++ b/app/models/budget/phase.rb @@ -3,6 +3,7 @@ class Budget PHASE_KINDS = %w(drafting accepting reviewing selecting valuating publishing_prices balloting reviewing_ballots finished).freeze PUBLISHED_PRICES_PHASES = %w(publishing_prices balloting reviewing_ballots finished).freeze + SUMMARY_MAX_LENGTH = 1000 DESCRIPTION_MAX_LENGTH = 2000 belongs_to :budget @@ -11,6 +12,7 @@ class Budget validates :budget, presence: true validates :kind, presence: true, uniqueness: { scope: :budget }, inclusion: { in: PHASE_KINDS } + validates :summary, length: { maximum: SUMMARY_MAX_LENGTH } validates :description, length: { maximum: DESCRIPTION_MAX_LENGTH } validate :invalid_dates_range? validate :prev_phase_dates_valid? diff --git a/config/routes/admin.rb b/config/routes/admin.rb index 93a1a0cc8..c372ec07f 100644 --- a/config/routes/admin.rb +++ b/config/routes/admin.rb @@ -51,6 +51,8 @@ namespace :admin do resources :budget_investment_milestones member { patch :toggle_selection } end + + resources :budget_phases, only: [:edit, :update] end resources :signature_sheets, only: [:index, :new, :create, :show] From a97c007150fb901ca9202cf45474875c0e4ebf95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Thu, 18 Jan 2018 21:33:22 +0100 Subject: [PATCH 2/6] Added admin budget phases views --- app/assets/stylesheets/admin.scss | 35 ++++++++++ app/views/admin/budget_phases/_form.html.erb | 67 ++++++++++++++++++++ app/views/admin/budget_phases/edit.html.erb | 5 ++ app/views/admin/budgets/_form.html.erb | 60 +++++++++++++++--- app/views/admin/budgets/edit.html.erb | 4 +- 5 files changed, 158 insertions(+), 13 deletions(-) create mode 100644 app/views/admin/budget_phases/_form.html.erb create mode 100644 app/views/admin/budget_phases/edit.html.erb diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index a2e3e0e7f..615e7ac43 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -9,6 +9,7 @@ // 07. Legislation // 08. CMS // 09. Map +// 10. Budget phases // // 01. Global styles @@ -1032,3 +1033,37 @@ table { visibility: hidden; height: 0; } + +// 10. Budget phases +// ----------------- +.budget-phase-enabled { + font-weight: bold; + padding-left: rem-calc(20); + position: relative; + text-decoration: none; + + &.enabled::before, + &.disabled::before { + font-family: 'icons'; + left: 0; + position: absolute; + } + + &.enabled { + color: $check; + + &::before { + color: $check; + content: '\6c'; + } + } + + &.disabled { + color: #000; + + &::before { + color: #000; + content: '\76'; + } + } +} diff --git a/app/views/admin/budget_phases/_form.html.erb b/app/views/admin/budget_phases/_form.html.erb new file mode 100644 index 000000000..9595907ac --- /dev/null +++ b/app/views/admin/budget_phases/_form.html.erb @@ -0,0 +1,67 @@ +<%= form_for [:admin, @phase.budget, @phase] do |f| %> + +
+
+
+ <%= f.label :starts_at, t("admin.budget_phases.edit.start_date") %> + <%= f.text_field :starts_at, + value: format_date_for_calendar_form(@phase.starts_at), + class: "js-calendar-full", + id: "start_date", + label: false %> +
+
+ <%= f.label :ends_at, t("admin.budget_phases.edit.end_date") %> + <%= f.text_field :ends_at, + value: format_date_for_calendar_form(@phase.ends_at), + class: "js-calendar-full", + id: "end_date", + label: false %> +
+
+ +
+
+ <%= f.label :summary, t("admin.budget_phases.edit.summary") %> + +

+ <%= t("admin.budget_phases.edit.summary_help_text") %> +

+ + <%= f.cktext_area :summary, + maxlength: Budget::Phase::SUMMARY_MAX_LENGTH, + ckeditor: { language: I18n.locale }, + label: false %> +
+
+ +
+
+ <%= f.label :description, t("admin.budget_phases.edit.description") %> + +

+ <%= t("admin.budget_phases.edit.description_help_text") %> +

+ + <%= f.cktext_area :description, + maxlength: Budget::Phase::DESCRIPTION_MAX_LENGTH, + ckeditor: { language: I18n.locale }, + label: false %> +
+
+ +
+
+ <%= f.check_box :enabled, label: t("admin.budget_phases.edit.enabled") %> + +

+ <%= t("admin.budget_phases.edit.enabled_help_text") %> +

+
+
+ +
+ <%= f.submit t("admin.budget_phases.edit.save_changes"), class: "button success" %> +
+
+<% end %> diff --git a/app/views/admin/budget_phases/edit.html.erb b/app/views/admin/budget_phases/edit.html.erb new file mode 100644 index 000000000..2d9659c7b --- /dev/null +++ b/app/views/admin/budget_phases/edit.html.erb @@ -0,0 +1,5 @@ +<%= back_link_to edit_admin_budget_path(@phase.budget) %> + +

<%= t("admin.budgets.edit.title") %> - <%= t("budgets.phase.#{@phase.kind}") %>

+ +<%= render '/admin/budget_phases/form' %> diff --git a/app/views/admin/budgets/_form.html.erb b/app/views/admin/budgets/_form.html.erb index 48a52079e..9b96107ac 100644 --- a/app/views/admin/budgets/_form.html.erb +++ b/app/views/admin/budgets/_form.html.erb @@ -2,12 +2,6 @@ <%= f.text_field :name, maxlength: Budget.title_max_length %> - <% Budget::Phase::PHASE_KINDS.each do |phase| %> -
- <%= f.cktext_area "description_#{phase}", maxlength: Budget::Phase::DESCRIPTION_MAX_LENGTH, ckeditor: { language: I18n.locale } %> -
- <% end %> -
<%= f.select :phase, budget_phases_select_options %> @@ -16,15 +10,61 @@ <%= f.select :currency_symbol, budget_currency_symbol_select_options %>
+ + <% if @budget.phases.present? %> + + + + + + + + + + + <% @budget.phases.each do |phase| %> + + + + + + + <% end %> +
<%= t("admin.budgets.edit.phase") %><%= t("admin.budgets.edit.dates") %><%= t("admin.budgets.edit.enabled") %><%= t("admin.budgets.edit.actions") %>
+ <%= t("budgets.phase.#{phase.kind}") %> + <% if @budget.current_phase == phase %> + <%= t("admin.budgets.edit.active") %> + <% end %> + + <% if phase.starts_at.present? && phase.ends_at.present? %> + <%= l phase.starts_at.to_date %> - <%= l phase.ends_at.to_date %> + <% else %> + <%= t("admin.budgets.edit.blank_dates") %> + <% end %> + + + + <%= link_to t("admin.budgets.edit.edit_phase"), + edit_admin_budget_budget_phase_path(@budget, phase), + method: :get, class: "button hollow" %> +
+ <% end %> +
<%= f.submit nil, class: "button success" %> - <% if @budget.balloting_process? %> -
+ +
+ <% if @budget.balloting_process? %> <%= link_to t("admin.budgets.winners.calculate"), calculate_winners_admin_budget_path(@budget), method: :put, class: "button hollow" %> -
- <% end %> + <% end %> + + <% if @budget.persisted? %> + <%= button_to t("admin.budgets.edit.delete"), admin_budget_path(@budget), method: :delete, class: "button hollow alert float-right" %> + <% end %> +
+
<% end %> diff --git a/app/views/admin/budgets/edit.html.erb b/app/views/admin/budgets/edit.html.erb index 16a39d3dc..6c54cc75b 100644 --- a/app/views/admin/budgets/edit.html.erb +++ b/app/views/admin/budgets/edit.html.erb @@ -1,7 +1,5 @@ <%= back_link_to admin_budgets_path %> -<%= button_to t("admin.budgets.edit.delete"), admin_budget_path(@budget), method: :delete, class: "button hollow alert float-right small" %> - -

<%= t("admin.budgets.edit.title") %>

+

<%= t("admin.budgets.edit.title") %>

<%= render '/admin/budgets/form' %> From c9f0bf49471db5d57d3a2ee35437cfad9fc35d1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Thu, 18 Jan 2018 21:33:31 +0100 Subject: [PATCH 3/6] Added new translations --- config/locales/en/admin.yml | 18 ++++++++++++++++++ config/locales/es/admin.yml | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 67dd4a88a..16f599c8b 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -85,6 +85,13 @@ en: edit: title: Edit Participatory budget delete: Delete budget + phase: Phase + dates: Dates + enabled: Enabled + actions: Actions + edit_phase: Edit phase + active: Active + blank_dates: Dates are blank destroy: success_notice: Budget deleted successfully unable_notice: You cannot destroy a Budget that has associated investments @@ -113,6 +120,17 @@ en: winners: calculate: Calculate Winner Investments calculated: Winners being calculated, it may take a minute. + budget_phases: + edit: + start_date: Start date + end_date: End date + summary: Summary + summary_help_text: This text will appear in the header when the phase is active + description: Description + description_help_text: This text will inform the user about the phase. To show it even if the phase is not active, select the checkbox below + enabled: Phase enabled + enabled_help_text: This phase will be public in the budget's phases timeline, as well as active for any other purpose + save_changes: Save changes budget_investments: index: heading_filter_all: All headings diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index b58b65c16..465cb11ff 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -85,6 +85,13 @@ es: edit: title: Editar campaña de presupuestos participativos delete: Eliminar presupuesto + phase: Fase + dates: Fechas + enabled: Habilitada + actions: Acciones + edit_phase: Editar fase + active: Activa + blank_dates: Sin fechas destroy: success_notice: Presupuesto eliminado correctamente unable_notice: No se puede eliminar un presupuesto con proyectos asociados @@ -113,6 +120,17 @@ es: winners: calculate: Calcular propuestas ganadoras calculated: Calculando ganadoras, puede tardar un minuto. + budget_phases: + edit: + start_date: Fecha de Inicio + end_date: Fecha de fin + summary: Resumen + summary_help_text: Este texto aparecerá en la cabecera cuando la fase esté activa + description: Descripción + description_help_text: Este texto informará al usuario sobre la fase. Para mostrarlo aunque la fase no esté activa, marca la opción de más abajo. + enabled: Fase habilitada + enabled_help_text: Esta fase será pública en el calendario de fases del presupuesto y estará activa para otros propósitos + save_changes: Guardar cambios budget_investments: index: heading_filter_all: Todas las partidas From 2fd53d63944940bc3caeb829544125b3ab1f315e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Fri, 19 Jan 2018 16:15:43 +0100 Subject: [PATCH 4/6] Added admin budget phases tests --- spec/features/admin/budget_phases_spec.rb | 33 +++++++++++++++++++++++ spec/features/admin/budgets_spec.rb | 25 +++++++++++++++-- 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 spec/features/admin/budget_phases_spec.rb diff --git a/spec/features/admin/budget_phases_spec.rb b/spec/features/admin/budget_phases_spec.rb new file mode 100644 index 000000000..3395c1e68 --- /dev/null +++ b/spec/features/admin/budget_phases_spec.rb @@ -0,0 +1,33 @@ +require 'rails_helper' + +feature 'Admin budget phases' do + let(:budget) { create(:budget) } + + context 'Edit' do + + before :each do + admin = create(:administrator) + login_as(admin.user) + end + + scenario 'Update phase' do + visit edit_admin_budget_budget_phase_path(budget, budget.current_phase) + + fill_in 'start_date', with: DateTime.current + 1.days + fill_in 'end_date', with: DateTime.current + 12.days + fill_in 'budget_phase_summary', with: 'This is the summary of the phase.' + fill_in 'budget_phase_description', with: 'This is the description of the phase.' + uncheck 'budget_phase_enabled' + click_button 'Save changes' + + expect(page).to have_current_path(edit_admin_budget_path(budget)) + expect(page).to have_content 'Changes saved' + + expect(budget.current_phase.starts_at.to_date).to eq((DateTime.current + 1.days).to_date) + expect(budget.current_phase.ends_at.to_date).to eq((DateTime.current + 12.days).to_date) + expect(budget.current_phase.summary).to eq('This is the summary of the phase.') + expect(budget.current_phase.description).to eq('This is the description of the phase.') + expect(budget.current_phase.enabled).to be(false) + end + end +end diff --git a/spec/features/admin/budgets_spec.rb b/spec/features/admin/budgets_spec.rb index 7b41715fe..f07fd7096 100644 --- a/spec/features/admin/budgets_spec.rb +++ b/spec/features/admin/budgets_spec.rb @@ -90,7 +90,6 @@ feature 'Admin budgets' do click_link 'Create new budget' fill_in 'budget_name', with: 'M30 - Summer campaign' - fill_in 'budget_description_accepting', with: 'Budgeting for summer 2017 maintenance and improvements of the road M-30' select 'Accepting projects', from: 'budget[phase]' click_button 'Create Participatory budget' @@ -134,7 +133,29 @@ feature 'Admin budgets' do expect(page).to have_content('There is 1 participatory budget') end end - + + context 'Edit' do + let!(:budget) { create(:budget) } + + scenario 'Show phases table' do + visit admin_budgets_path + click_link 'Edit budget' + + within '#budget-phases-table' do + budget.phases.each do |phase| + within "#budget_phase_#{phase.id}" do + expect(page).to have_content(I18n.t("budgets.phase.#{phase.kind}")) + expect(page).to have_content("#{phase.starts_at.to_date} - #{phase.ends_at.to_date}") + expect(page).to have_css('.budget-phase-enabled.enabled') + expect(page).to have_link('Edit phase', href: edit_admin_budget_budget_phase_path(budget, phase)) + + expect(page).to have_content('Active') if budget.current_phase == phase + end + end + end + end + end + context 'Update' do background do From 94279448f3c6229dcbb0fd145fba88fc0a726ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Fri, 19 Jan 2018 17:03:29 +0100 Subject: [PATCH 5/6] Replaced 'participatory budget' with 'budget' --- config/locales/en/activerecord.yml | 4 ++-- config/locales/en/budgets.yml | 6 +++--- spec/features/admin/budgets_spec.rb | 22 +++++++++++----------- spec/features/budgets/budgets_spec.rb | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/config/locales/en/activerecord.yml b/config/locales/en/activerecord.yml index ec3003010..81b25dcad 100644 --- a/config/locales/en/activerecord.yml +++ b/config/locales/en/activerecord.yml @@ -5,8 +5,8 @@ en: one: "activity" other: "activities" budget: - one: "Participatory budget" - other: "Participatory budgets" + one: "Budget" + other: "Budgets" budget/investment: one: "Investment" other: "Investments" diff --git a/config/locales/en/budgets.yml b/config/locales/en/budgets.yml index 193c0d9e7..e41c07535 100644 --- a/config/locales/en/budgets.yml +++ b/config/locales/en/budgets.yml @@ -43,7 +43,7 @@ en: section_header: icon_alt: Participatory budgets icon title: Participatory budgets - help: Help about participatory budgets + help: Help with participatory budgets all_phases: See all phases all_phases: Budget investment's phases map: Budget investments' proposals located geographically @@ -53,7 +53,7 @@ en: finished_budgets: Finished participatory budgets see_results: See results section_footer: - title: Help about participatory budgets + title: Help with participatory budgets description: With the participatory budgets the citizens decide to which projects presented by the neighbors is destined a part of the municipal budget. help_text_1: "Participatory budgets are processes in which citizens decide directly on what is spent part of the municipal budget. Any registered person over 16 years old can propose an investment project that is preselected in a phase of citizen supports." help_text_2: "The most voted projects are evaluated and passed to a final vote in which they decide the actions to be carried out by the City Council once the municipal budgets of the next year are approved." @@ -170,4 +170,4 @@ en: errors: dates_range_invalid: "Start date can't be equal or later than End date" prev_phase_dates_invalid: "Start date must be later than the start date of the previous enabled phase (%{phase_name})" - next_phase_dates_invalid: "End date must be earlier than the end date of the next enabled phase (%{phase_name})" \ No newline at end of file + next_phase_dates_invalid: "End date must be earlier than the end date of the next enabled phase (%{phase_name})" diff --git a/spec/features/admin/budgets_spec.rb b/spec/features/admin/budgets_spec.rb index f07fd7096..7bf48903f 100644 --- a/spec/features/admin/budgets_spec.rb +++ b/spec/features/admin/budgets_spec.rb @@ -92,7 +92,7 @@ feature 'Admin budgets' do fill_in 'budget_name', with: 'M30 - Summer campaign' select 'Accepting projects', from: 'budget[phase]' - click_button 'Create Participatory budget' + click_button 'Create Budget' expect(page).to have_content 'New participatory budget created successfully!' expect(page).to have_content 'M30 - Summer campaign' @@ -100,7 +100,7 @@ feature 'Admin budgets' do scenario 'Name is mandatory' do visit new_admin_budget_path - click_button 'Create Participatory budget' + click_button 'Create Budget' expect(page).not_to have_content 'New participatory budget created successfully!' expect(page).to have_css("label.error", text: "Name") @@ -119,7 +119,7 @@ feature 'Admin budgets' do click_button 'Delete budget' expect(page).to have_content('Budget deleted successfully') - expect(page).to have_content('participatory budgets cannot be found') + expect(page).to have_content('budgets cannot be found') end scenario 'Try to destroy a budget with investments' do @@ -130,7 +130,7 @@ feature 'Admin budgets' do click_button 'Delete budget' expect(page).to have_content('You cannot destroy a Budget that has associated investments') - expect(page).to have_content('There is 1 participatory budget') + expect(page).to have_content('There is 1 budget') end end @@ -167,7 +167,7 @@ feature 'Admin budgets' do click_link 'Edit budget' fill_in 'budget_name', with: 'More trees on the streets' - click_button 'Update Participatory budget' + click_button 'Update Budget' expect(page).to have_content('More trees on the streets') expect(page).to have_current_path(admin_budgets_path) @@ -205,7 +205,7 @@ feature 'Admin budgets' do context 'Manage groups and headings' do scenario 'Create group', :js do - budget = create(:budget, name: 'Yearly participatory budget') + budget = create(:budget, name: 'Yearly budget') visit admin_budgets_path @@ -223,7 +223,7 @@ feature 'Admin budgets' do expect(page).to have_content '1 Group of budget headings' expect(page).to have_content 'Health' - expect(page).to have_content 'Yearly participatory budget' + expect(page).to have_content 'Yearly budget' expect(page).not_to have_content 'No groups created yet.' visit admin_budgets_path @@ -233,12 +233,12 @@ feature 'Admin budgets' do expect(page).to have_content '1 Group of budget headings' expect(page).to have_content 'Health' - expect(page).to have_content 'Yearly participatory budget' + expect(page).to have_content 'Yearly budget' expect(page).not_to have_content 'No groups created yet.' end scenario 'Create heading', :js do - budget = create(:budget, name: 'Yearly participatory budget') + budget = create(:budget, name: 'Yearly budget') group = create(:budget_group, budget: budget, name: 'Districts improvments') visit admin_budget_path(budget) @@ -266,7 +266,7 @@ feature 'Admin budgets' do end scenario 'Update heading', :js do - budget = create(:budget, name: 'Yearly participatory budget') + budget = create(:budget, name: 'Yearly budget') group = create(:budget_group, budget: budget, name: 'Districts improvments') heading = create(:budget_heading, group: group, name: "District 1") heading = create(:budget_heading, group: group, name: "District 3") @@ -288,7 +288,7 @@ feature 'Admin budgets' do end scenario 'Delete heading', :js do - budget = create(:budget, name: 'Yearly participatory budget') + budget = create(:budget, name: 'Yearly budget') group = create(:budget_group, budget: budget, name: 'Districts improvments') heading = create(:budget_heading, group: group, name: "District 1") diff --git a/spec/features/budgets/budgets_spec.rb b/spec/features/budgets/budgets_spec.rb index 71e0b9a4a..ae30ca50c 100644 --- a/spec/features/budgets/budgets_spec.rb +++ b/spec/features/budgets/budgets_spec.rb @@ -21,7 +21,7 @@ feature 'Budgets' do expect(page).to have_content(last_budget.description) expect(page).to have_content("Actual phase") expect(page).to have_content("Accepting projects") - expect(page).to have_link 'Help about participatory budgets' + expect(page).to have_link 'Help with participatory budgets' expect(page).to have_link 'See all phases' end From 8eaf0982b1d5fcaf33ff5fcf6e5eaa7f4017d632 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Sat, 20 Jan 2018 11:17:56 +0100 Subject: [PATCH 6/6] Fixed Admin Budget's destroy button to a link Why: The Admin Budget form has a submit button for saving the record, adding another submit input to destroy the record actually adds to the html: `` and it collides with the save button, forcing it to perform a destroy instead of save. Previously the destroy button was not in the same div as the save button How: Just changing the Destroy from a button_to to a link_to. --- app/views/admin/budgets/_form.html.erb | 2 +- spec/features/admin/budgets_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/admin/budgets/_form.html.erb b/app/views/admin/budgets/_form.html.erb index 9b96107ac..44e395f6f 100644 --- a/app/views/admin/budgets/_form.html.erb +++ b/app/views/admin/budgets/_form.html.erb @@ -62,7 +62,7 @@ <% end %> <% if @budget.persisted? %> - <%= button_to t("admin.budgets.edit.delete"), admin_budget_path(@budget), method: :delete, class: "button hollow alert float-right" %> + <%= link_to t("admin.budgets.edit.delete"), admin_budget_path(@budget), method: :delete, class: "button hollow alert float-right" %> <% end %> diff --git a/spec/features/admin/budgets_spec.rb b/spec/features/admin/budgets_spec.rb index 7bf48903f..7da02b559 100644 --- a/spec/features/admin/budgets_spec.rb +++ b/spec/features/admin/budgets_spec.rb @@ -116,7 +116,7 @@ feature 'Admin budgets' do scenario 'Destroy a budget without investments' do visit admin_budgets_path click_link 'Edit budget' - click_button 'Delete budget' + click_link 'Delete budget' expect(page).to have_content('Budget deleted successfully') expect(page).to have_content('budgets cannot be found') @@ -127,7 +127,7 @@ feature 'Admin budgets' do visit admin_budgets_path click_link 'Edit budget' - click_button 'Delete budget' + click_link 'Delete budget' expect(page).to have_content('You cannot destroy a Budget that has associated investments') expect(page).to have_content('There is 1 budget')