From e922a11aa336a0e1ce4a12d9af66e488e83569e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baza=CC=81n?= Date: Fri, 19 May 2017 11:32:14 +0200 Subject: [PATCH] permits fields in management investment creation --- .../management/budgets/investments_controller.rb | 2 +- spec/features/budgets/investments_spec.rb | 11 ++++++++--- spec/features/management/budget_investments_spec.rb | 6 +++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/controllers/management/budgets/investments_controller.rb b/app/controllers/management/budgets/investments_controller.rb index 025b6301d..652d2b9a7 100644 --- a/app/controllers/management/budgets/investments_controller.rb +++ b/app/controllers/management/budgets/investments_controller.rb @@ -52,7 +52,7 @@ class Management::Budgets::InvestmentsController < Management::BaseController end def investment_params - params.require(:budget_investment).permit(:title, :description, :external_url, :heading_id) + params.require(:budget_investment).permit(:title, :description, :external_url, :heading_id, :tag_list, :organization_name, :location) end def only_verified_users diff --git a/spec/features/budgets/investments_spec.rb b/spec/features/budgets/investments_spec.rb index d8855712c..1c6b1c7c8 100644 --- a/spec/features/budgets/investments_spec.rb +++ b/spec/features/budgets/investments_spec.rb @@ -211,7 +211,7 @@ feature 'Budget Investments' do expect(current_path).to eq(new_budget_investment_path(budget_id: budget.id)) end - scenario 'Create notice' do + scenario 'Create' do login_as(author) visit new_budget_investment_path(budget_id: budget.id) @@ -220,15 +220,20 @@ feature 'Budget Investments' do fill_in 'budget_investment_title', with: 'Build a skyscraper' fill_in 'budget_investment_description', with: 'I want to live in a high tower over the clouds' fill_in 'budget_investment_external_url', with: 'http://http://skyscraperpage.com/' + fill_in 'budget_investment_location', with: 'City center' check 'budget_investment_terms_of_service' click_button 'Create Investment' expect(page).to have_content 'Investment created successfully' + expect(page).to have_content 'Build a skyscraper' + expect(page).to have_content 'I want to live in a high tower over the clouds' + expect(page).to have_content 'http://http://skyscraperpage.com/' + expect(page).to have_content 'City center' visit user_url(author, filter: :budget_investments) - expect(page).to have_content "1 Investment" - expect(page).to have_content "Build a skyscraper" + expect(page).to have_content '1 Investment' + expect(page).to have_content 'Build a skyscraper' end scenario 'Errors on create' do diff --git a/spec/features/management/budget_investments_spec.rb b/spec/features/management/budget_investments_spec.rb index c4d7a8797..a066a9089 100644 --- a/spec/features/management/budget_investments_spec.rb +++ b/spec/features/management/budget_investments_spec.rb @@ -4,7 +4,7 @@ feature 'Budget Investments' do background do login_as_manager - @budget = create(:budget, phase: 'selecting', name: "2016") + @budget = create(:budget, phase: 'selecting', name: "2033") @group = create(:budget_group, budget: @budget, name: 'Whole city') @heading = create(:budget_heading, group: @group, name: "Health") end @@ -33,18 +33,18 @@ feature 'Budget Investments' do fill_in 'budget_investment_title', with: 'Build a park in my neighborhood' fill_in 'budget_investment_description', with: 'There is no parks here...' fill_in 'budget_investment_external_url', with: 'http://moarparks.com' + fill_in 'budget_investment_location', with: 'City center' check 'budget_investment_terms_of_service' click_button 'Create Investment' expect(page).to have_content 'Investment created successfully.' - expect(page).to have_content '2017' - #expect(page).to have_content 'Whole city' expect(page).to have_content 'Health' expect(page).to have_content 'Build a park in my neighborhood' expect(page).to have_content 'There is no parks here...' expect(page).to have_content 'http://moarparks.com' + expect(page).to have_content 'City center' expect(page).to have_content user.name expect(page).to have_content I18n.l(@budget.created_at.to_date) end