Browse Source

locations migration and model

pull/662/head
JG 3 years ago
parent
commit
f96a65b045
  1. 3
      app/models/location.rb
  2. 17
      db/migrate/20220614124115_create_locations.rb
  3. 2
      spec/features/schemes_spec.rb

3
app/models/location.rb

@ -0,0 +1,3 @@
class Location < ApplicationRecord
belongs_to :scheme
end

17
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

2
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

Loading…
Cancel
Save