Add specs to accept comma as a fraction separator in billing price

#475
This commit is contained in:
Artur Beljajev 2017-04-27 15:26:35 +03:00
parent 7cadf66920
commit 71102bb5e8
2 changed files with 31 additions and 0 deletions

View file

@ -77,6 +77,18 @@ RSpec.describe Billing::Price do
price.validate
expect(price.errors).to_not have_key(:price)
end
it 'accepts period as fraction separator' do
price.price = 1.5
price.validate
expect(price.errors).to_not have_key(:price)
end
it 'accepts comma as fraction separator' do
price.price = '1,5'
price.validate
expect(price.errors).to_not have_key(:price)
end
end
describe 'duration validation', db: false do

View file

@ -0,0 +1,19 @@
require 'rails_helper'
require 'views/shared_examples/money_form_field'
RSpec.describe 'admin/billing/prices/_form' do
let(:price) { build_stubbed(:price) }
before :example do
allow(view).to receive(:price).and_return(price)
allow(view).to receive(:zones).and_return([])
allow(view).to receive(:operation_categories).and_return([])
allow(view).to receive(:durations).and_return([])
stub_template '_form_errors' => ''
end
describe 'price' do
let(:field) { page.find('#price_price') }
it_behaves_like 'money form field'
end
end