diff --git a/app/models/location.rb b/app/models/location.rb new file mode 100644 index 000000000..e58f6dec6 --- /dev/null +++ b/app/models/location.rb @@ -0,0 +1,3 @@ +class Location < ApplicationRecord + belongs_to :scheme +end diff --git a/db/migrate/20220614124115_create_locations.rb b/db/migrate/20220614124115_create_locations.rb new file mode 100644 index 000000000..e74ba019a --- /dev/null +++ b/db/migrate/20220614124115_create_locations.rb @@ -0,0 +1,17 @@ +class CreateLocations < ActiveRecord::Migration[7.0] + def change + create_table :locations do |t| + t.string :location_code + t.string :postcode + t.string :type_of_unit + t.string :type_of_building + t.integer :wheelchair_adaptation + t.references :scheme, null: false, foreign_key: true + t.string :address_line1 + t.string :address_line2 + t.string :county + + t.timestamps + end + end +end diff --git a/spec/features/schemes_spec.rb b/spec/features/schemes_spec.rb index 18f174890..41467e49a 100644 --- a/spec/features/schemes_spec.rb +++ b/spec/features/schemes_spec.rb @@ -131,7 +131,7 @@ RSpec.describe "Supported housing scheme Features" do it "shows service and locations tab" do expect(page).to have_link("Scheme") - expect(page).to have_link("#{schemes.count} locations") + expect(page).to have_link("#{schemes.first.locations.count} locations") end end end