permits fields in management investment creation

This commit is contained in:
Juanjo Bazán
2017-05-19 11:32:14 +02:00
parent f0d7acd087
commit e922a11aa3
3 changed files with 12 additions and 7 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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