diff --git a/app/controllers/admin/budget_investments_controller.rb b/app/controllers/admin/budget_investments_controller.rb index 9bf4d4610..c81ccfcc3 100644 --- a/app/controllers/admin/budget_investments_controller.rb +++ b/app/controllers/admin/budget_investments_controller.rb @@ -61,12 +61,13 @@ class Admin::BudgetInvestmentsController < Admin::BaseController end def load_investments - if params[:project_title].present? - @investments = Budget::Investment.where("title ILIKE ?", "%#{params[:project_title].strip}%") - else - @investments = Budget::Investment.scoped_filter(params, @current_filter) + @investments = if params[:project_title].present? + Budget::Investment.where("title ILIKE ?", + "%#{params[:project_title].strip}%") + else + Budget::Investment.scoped_filter(params, @current_filter) .order(sort_by(params[:sort_by])) - end + end @investments = @investments.page(params[:page]) unless request.format.csv? end diff --git a/spec/features/admin/budget_investments_spec.rb b/spec/features/admin/budget_investments_spec.rb index 096bb5146..e6f8ab0a2 100644 --- a/spec/features/admin/budget_investments_spec.rb +++ b/spec/features/admin/budget_investments_spec.rb @@ -372,7 +372,7 @@ feature 'Admin budget investments' do click_button 'Search' expect(page).to have_content(@investment_1.title) - expect(page).to_not have_content(@investment_2.title) + expect(page).not_to have_content(@investment_2.title) end end diff --git a/spec/features/admin/budget_phases_spec.rb b/spec/features/admin/budget_phases_spec.rb index 3395c1e68..c22037936 100644 --- a/spec/features/admin/budget_phases_spec.rb +++ b/spec/features/admin/budget_phases_spec.rb @@ -5,7 +5,7 @@ feature 'Admin budget phases' do context 'Edit' do - before :each do + before do admin = create(:administrator) login_as(admin.user) end @@ -13,8 +13,8 @@ feature 'Admin budget phases' do 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 'start_date', with: Date.current + 1.days + fill_in 'end_date', with: Date.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' @@ -23,8 +23,8 @@ feature 'Admin budget phases' do 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.starts_at.to_date).to eq((Date.current + 1.days).to_date) + expect(budget.current_phase.ends_at.to_date).to eq((Date.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) diff --git a/spec/models/budget_spec.rb b/spec/models/budget_spec.rb index 75e78a6dd..c41182bdd 100644 --- a/spec/models/budget_spec.rb +++ b/spec/models/budget_spec.rb @@ -192,7 +192,7 @@ describe Budget do describe "#generate_phases" do let(:drafting_phase) { budget.phases.drafting } - let(:informing_phase) { budget.phases.informing } + let(:informing_phase) { budget.phases.informing } let(:accepting_phase) { budget.phases.accepting } let(:reviewing_phase) { budget.phases.reviewing } let(:selecting_phase) { budget.phases.selecting }