Browse Source

Check that the location gets confirmed

pull/1428/head
Kat 3 years ago
parent
commit
872314afe4
  1. 4
      app/services/imports/scheme_location_import_service.rb
  2. 6
      spec/services/imports/scheme_location_import_service_spec.rb

4
app/services/imports/scheme_location_import_service.rb

@ -97,7 +97,7 @@ module Imports
end
def add_location(scheme, attributes)
location = Location.new(
location = Location.create!(
name: attributes["location_name"],
postcode: attributes["postcode"],
mobility_type: attributes["mobility_type"],
@ -108,8 +108,6 @@ module Imports
startdate: attributes["start_date"],
scheme:,
)
confirm_scheme_or_location(location)
location.save!
if attributes["end_date"]
location.location_deactivation_periods.create!(deactivation_date: attributes["end_date"])
end

6
spec/services/imports/scheme_location_import_service_spec.rb

@ -16,6 +16,11 @@ RSpec.describe Imports::SchemeLocationImportService do
File.open("#{directory}/#{filename}.xml")
end
before do
WebMock.stub_request(:get, /api.postcodes.io\/postcodes/)
.to_return(status: 200, body: '{"status":200,"result":{"admin_district":"Westminster","codes":{"admin_district":"E08000035"}}}', headers: {})
end
context "when importing scheme locations" do
let(:remote_folder) { "schemes" }
@ -145,6 +150,7 @@ RSpec.describe Imports::SchemeLocationImportService do
expect(location.old_visible_id).to eq("10")
expect(location.startdate).to eq("1900-01-01")
expect(location.scheme).to eq(scheme)
expect(location.confirmed).to eq(true)
end
it "matches expected schemes values" do

Loading…
Cancel
Save