changes price columns type: float to integer

This commit is contained in:
Juanjo Bazán
2016-03-08 11:46:16 +01:00
parent fcd6d0ce8b
commit 6e28ae790c
3 changed files with 20 additions and 9 deletions

View File

@@ -0,0 +1,11 @@
class ChangePriceFieldsInSpendingProposals < ActiveRecord::Migration
def up
change_column :spending_proposals, :price, :integer
change_column :spending_proposals, :price_first_year, :integer
end
def down
change_column :spending_proposals, :price, :float
change_column :spending_proposals, :price_first_year, :float
end
end

View File

@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160307150804) do
ActiveRecord::Schema.define(version: 20160308103548) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -299,7 +299,7 @@ ActiveRecord::Schema.define(version: 20160307150804) do
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "geozone_id"
t.float "price"
t.integer "price"
t.boolean "feasible"
t.string "association_name"
t.text "price_explanation"
@@ -309,7 +309,7 @@ ActiveRecord::Schema.define(version: 20160307150804) do
t.text "explanations_log"
t.integer "administrator_id"
t.integer "valuation_assignments_count", default: 0
t.float "price_first_year"
t.integer "price_first_year"
t.string "time_scope"
end

View File

@@ -143,7 +143,7 @@ feature 'Valuation spending proposals' do
spending_proposal = create(:spending_proposal,
geozone: create(:geozone),
association_name: 'People of the neighbourhood',
price: 1234.56,
price: 1234,
feasible: false,
feasible_explanation: 'It is impossible',
administrator: administrator)
@@ -158,7 +158,7 @@ feature 'Valuation spending proposals' do
expect(page).to have_content(spending_proposal.author.name)
expect(page).to have_content(spending_proposal.association_name)
expect(page).to have_content(spending_proposal.geozone.name)
expect(page).to have_content('1234.56')
expect(page).to have_content('1234')
expect(page).to have_content('Not feasible')
expect(page).to have_content('It is impossible')
expect(page).to have_content('Ana (ana@admins.org)')
@@ -195,8 +195,8 @@ feature 'Valuation spending proposals' do
click_link "Edit"
end
fill_in 'spending_proposal_price', with: '12345.67'
fill_in 'spending_proposal_price_first_year', with: '8910.11'
fill_in 'spending_proposal_price', with: '12345'
fill_in 'spending_proposal_price_first_year', with: '9876'
fill_in 'spending_proposal_price_explanation', with: 'Very cheap idea'
choose 'spending_proposal_feasible_true'
fill_in 'spending_proposal_feasible_explanation', with: 'Everything is legal and easy to do'
@@ -209,8 +209,8 @@ feature 'Valuation spending proposals' do
visit valuation_spending_proposals_path
click_link @spending_proposal.title
within('#price') { expect(page).to have_content('12345.67') }
within('#price_first_year') { expect(page).to have_content('8910.11') }
within('#price') { expect(page).to have_content('12345') }
within('#price_first_year') { expect(page).to have_content('9876') }
expect(page).to have_content('Very cheap idea')
within('#time_scope') { expect(page).to have_content('19 months') }
within('#feasibility') { expect(page).to have_content('Feasible') }