mirror of
https://github.com/we-promise/sure.git
synced 2026-05-12 15:15:01 +00:00
fix: change postal_code column from integer to string (#1585)
* fix: change postal_code column from integer to string Allows non-numeric postal codes such as UK format (e.g. SW1A 2AA). The integer column was silently dropping any alphanumeric input. The migration is marked irreversible — once alphanumeric postal codes exist, they cannot be safely cast back to integer. * fix: update schema.rb, quote fixture postal_code, and add alphanumeric test * fix: use conventional migration timestamp
This commit is contained in:
2
test/fixtures/addresses.yml
vendored
2
test/fixtures/addresses.yml
vendored
@@ -4,6 +4,6 @@ one:
|
||||
locality: Los Angeles
|
||||
region: CA
|
||||
country: US
|
||||
postal_code: 90001
|
||||
postal_code: "90001"
|
||||
addressable: one
|
||||
addressable_type: Property
|
||||
|
||||
@@ -39,6 +39,12 @@ class AddressTest < ActiveSupport::TestCase
|
||||
assert_equal "", address.to_s
|
||||
end
|
||||
|
||||
test "accepts alphanumeric postal codes" do
|
||||
address = addresses(:one)
|
||||
address.update!(postal_code: "SW1A 2AA")
|
||||
assert_equal "SW1A 2AA", address.reload.postal_code
|
||||
end
|
||||
|
||||
test "can strip extras commas and spaces" do
|
||||
address = Address.new(
|
||||
line1: "123 Main St ,",
|
||||
|
||||
Reference in New Issue
Block a user