Added comma support #2785

This commit is contained in:
Priit Tark 2015-08-10 20:04:20 +03:00
parent f5311301c9
commit e9cf3d2fbe
15 changed files with 80 additions and 21 deletions

View file

@ -46,7 +46,7 @@ feature 'BankStatement', type: :feature do
click_link 'Back to bank statement'
page.should have_content('120.0')
page.should have_content('120,00')
page.should have_content('Test buyer')
end
end

View file

@ -37,7 +37,7 @@ feature 'Invoice', type: :feature do
page.should have_content('Record created')
page.should have_content('Invoice no.')
page.should have_content('Prepayment')
page.should have_content('120.0')
page.should have_content('120,00')
page.should have_content(r.name)
end
@ -107,7 +107,7 @@ feature 'Invoice', type: :feature do
page.should have_content('689')
page.should have_content('EE557700771000598731')
page.should have_content('Not binded', count: 2)
page.should have_content(invoice.sum.to_s)
page.should have_content('240,00')
page.should have_content('EUR')
click_link 'Bind invoices'
@ -120,7 +120,7 @@ feature 'Invoice', type: :feature do
page.should have_content('Binded')
page.should have_content(invoice.to_s)
page.should have_content(invoice.sum.to_s)
page.should have_content('240,00')
page.should have_content(invoice.reference_no)
page.should have_content(I18n.l(paid_at, format: :date_long))

View file

@ -0,0 +1,39 @@
require 'rails_helper'
describe Deposit do
context 'with invalid attribute' do
before :all do
@deposit = Deposit.new
end
it 'should not be valid' do
@deposit.valid?
@deposit.errors.full_messages.should match_array([
"Registrar is missing"
])
end
it 'should have 0 amount' do
@deposit.amount.should == 0
end
it 'should not be presisted' do
@deposit.persisted?.should == false
end
it 'should replace comma with point for 0' do
@deposit.amount = '0,0'
@deposit.amount.should == 0.0
end
it 'should replace comma with points' do
@deposit.amount = '10,11'
@deposit.amount.should == 10.11
end
it 'should work with float as well' do
@deposit.amount = 0.123
@deposit.amount.should == 0.123
end
end
end