diff --git a/app/models/address.rb b/app/models/address.rb new file mode 100644 index 000000000..a52c02dfd --- /dev/null +++ b/app/models/address.rb @@ -0,0 +1,24 @@ +class Address < ApplicationRecord + extend ActiveHash::Associations::ActiveRecordExtensions + + include Addresses::Base + # 🚅 add concerns above. + + # 🚅 add belongs_to associations above. + + # 🚅 add has_many associations above. + + # 🚅 add oauth providers above. + + # 🚅 add has_one associations above. + + # 🚅 add scopes above. + + # 🚅 add validations above. + + # 🚅 add callbacks above. + + # 🚅 add delegations above. + + # 🚅 add methods above. +end diff --git a/app/models/addresses/continent.rb b/app/models/addresses/continent.rb new file mode 100644 index 000000000..aaaa00681 --- /dev/null +++ b/app/models/addresses/continent.rb @@ -0,0 +1,22 @@ +class Addresses::Continent < ApplicationHash + include Addresses::Continents::Base + # 🚅 add concerns above. + + # 🚅 add belongs_to associations above. + + # 🚅 add has_many associations above. + + # 🚅 add oauth providers above. + + # 🚅 add has_one associations above. + + # 🚅 add scopes above. + + # 🚅 add validations above. + + # 🚅 add callbacks above. + + # 🚅 add delegations above. + + # 🚅 add methods above. +end diff --git a/app/models/addresses/country.rb b/app/models/addresses/country.rb new file mode 100644 index 000000000..9402dcce5 --- /dev/null +++ b/app/models/addresses/country.rb @@ -0,0 +1,22 @@ +class Addresses::Country < ApplicationHash + include Addresses::Countries::Base + # 🚅 add concerns above. + + # 🚅 add belongs_to associations above. + + # 🚅 add has_many associations above. + + # 🚅 add oauth providers above. + + # 🚅 add has_one associations above. + + # 🚅 add scopes above. + + # 🚅 add validations above. + + # 🚅 add callbacks above. + + # 🚅 add delegations above. + + # 🚅 add methods above. +end diff --git a/app/models/addresses/region.rb b/app/models/addresses/region.rb new file mode 100644 index 000000000..d753d4ff2 --- /dev/null +++ b/app/models/addresses/region.rb @@ -0,0 +1,22 @@ +class Addresses::Region < ApplicationHash + include Addresses::Regions::Base + # 🚅 add concerns above. + + # 🚅 add belongs_to associations above. + + # 🚅 add has_many associations above. + + # 🚅 add oauth providers above. + + # 🚅 add has_one associations above. + + # 🚅 add scopes above. + + # 🚅 add validations above. + + # 🚅 add callbacks above. + + # 🚅 add delegations above. + + # 🚅 add methods above. +end diff --git a/app/models/addresses/subcontinent.rb b/app/models/addresses/subcontinent.rb new file mode 100644 index 000000000..22cc6446b --- /dev/null +++ b/app/models/addresses/subcontinent.rb @@ -0,0 +1,22 @@ +class Addresses::Subcontinent < ApplicationHash + include Addresses::Subcontinents::Base + # 🚅 add concerns above. + + # 🚅 add belongs_to associations above. + + # 🚅 add has_many associations above. + + # 🚅 add oauth providers above. + + # 🚅 add has_one associations above. + + # 🚅 add scopes above. + + # 🚅 add validations above. + + # 🚅 add callbacks above. + + # 🚅 add delegations above. + + # 🚅 add methods above. +end diff --git a/db/migrate/20230123162616_create_addresses.rb b/db/migrate/20230123162616_create_addresses.rb new file mode 100644 index 000000000..8deaf2e65 --- /dev/null +++ b/db/migrate/20230123162616_create_addresses.rb @@ -0,0 +1,16 @@ +class CreateAddresses < ActiveRecord::Migration[7.0] + def change + create_table :addresses do |t| + t.references :addressable, polymorphic: true, null: false + t.string :address_one + t.string :address_two + t.string :city + t.integer :region_id + t.string :region_name + t.integer :country_id + t.string :postal_code + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index f52d0bb36..ab239c3dc 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2022_12_31_003438) do +ActiveRecord::Schema[7.0].define(version: 2023_01_23_162616) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -61,6 +61,21 @@ t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true end + create_table "addresses", force: :cascade do |t| + t.string "addressable_type", null: false + t.bigint "addressable_id", null: false + t.string "address_one" + t.string "address_two" + t.string "city" + t.integer "region_id" + t.string "region_name" + t.integer "country_id" + t.string "postal_code" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["addressable_type", "addressable_id"], name: "index_addresses_on_addressable" + end + create_table "integrations_stripe_installations", force: :cascade do |t| t.bigint "team_id", null: false t.bigint "oauth_stripe_account_id", null: false diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index 14b2c6dd8..d60cb4831 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -259,9 +259,9 @@ def assert_no_js_errors &block def find_stimulus_controller_for_label(label, stimulus_controller, wrapper = false) if wrapper wrapper_el = find("label", text: /\A#{label}\z/).first(:xpath, ".//..//..") - wrapper_el if wrapper_el["data-controller"] == stimulus_controller + wrapper_el if wrapper_el["data-controller"].split(" ").include?(stimulus_controller) else - find("label", text: /\A#{label}\z/).first(:xpath, ".//..").first('[data-controller="' + stimulus_controller + '"]') + find("label", text: /\A#{label}\z/).first(:xpath, ".//..").first('[data-controller~="' + stimulus_controller + '"]') end end diff --git a/test/factories/addresses.rb b/test/factories/addresses.rb new file mode 100644 index 000000000..8b1b29a30 --- /dev/null +++ b/test/factories/addresses.rb @@ -0,0 +1,12 @@ +FactoryBot.define do + factory :address do + addressable { nil } + address_one { "1000 Vin Scully Avenue" } + address_two { nil } + city { "Los Angeles" } + region_id { 1416 } + region_name { "California" } + country_id { 233 } + postal_code { "90090" } + end +end diff --git a/test/system/tangible_thing_test.rb b/test/system/tangible_thing_test.rb index b3484ec0f..a172cebc9 100644 --- a/test/system/tangible_thing_test.rb +++ b/test/system/tangible_thing_test.rb @@ -54,6 +54,11 @@ class TangibleThingTest < ApplicationSystemTestCase fill_in "Email Field Value", with: "me@acme.com" fill_in "Password Field Value", with: "secure-password" fill_in "Phone Field Value", with: "(201) 551-8321" + + assert page.has_content? "State / Province" + select "Japan", from: "Country" + assert page.has_content? "Prefecture" + select "One", from: "Super Select Value" select2_select "Multiple Super Select Values", ["Five", "Six"] fill_in "Text Area Value", with: "Long text for this text area field"