mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-29 21:17:17 +00:00
Increases the maximum number of digits (on the left side of the decimal place) that the column can hold, to allow larger values. This change is made in Spree 2.2 and is relevant in cases with either large order values, or certain currencies that have large values as standard. For example, 100 UK Pounds is roughly 4000 Thai Baht. 1 million pounds is unlikely to ever be needed as a value, but 1 million Baht is not so unlikely...
30 lines
656 B
Ruby
30 lines
656 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'spec_helper'
|
|
|
|
module Spree
|
|
describe Price do
|
|
let(:variant) { create(:variant) }
|
|
let(:price) { variant.default_price }
|
|
|
|
context "when variant is soft-deleted" do
|
|
before do
|
|
variant.destroy
|
|
end
|
|
|
|
it "can access the variant" do
|
|
expect(price.reload.variant).to eq variant
|
|
end
|
|
end
|
|
|
|
context "with large values" do
|
|
let(:expensive_variant) { build(:variant, price: 10_000_000) }
|
|
|
|
it "saves without error" do
|
|
expect{ expensive_variant.save }.to_not raise_error
|
|
expect(expensive_variant.persisted?).to be true
|
|
end
|
|
end
|
|
end
|
|
end
|