mirror of
https://github.com/internetee/registry.git
synced 2025-08-12 12:39:34 +02:00
Add specs to accept comma as a fraction separator in billing price
#475
This commit is contained in:
parent
7cadf66920
commit
71102bb5e8
2 changed files with 31 additions and 0 deletions
|
@ -77,6 +77,18 @@ RSpec.describe Billing::Price do
|
||||||
price.validate
|
price.validate
|
||||||
expect(price.errors).to_not have_key(:price)
|
expect(price.errors).to_not have_key(:price)
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe 'duration validation', db: false do
|
describe 'duration validation', db: false do
|
||||||
|
|
19
spec/views/admin/billing/prices/_form.html.erb_spec.rb
Normal file
19
spec/views/admin/billing/prices/_form.html.erb_spec.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue