Browse Source

refactor: lint

pull/1879/head
natdeanlewissoftwire 3 years ago
parent
commit
c8f77d090a
  1. 21
      spec/services/imports/lettings_logs_import_service_spec.rb
  2. 5
      spec/services/imports/organisation_import_service_spec.rb

21
spec/services/imports/lettings_logs_import_service_spec.rb

@ -1470,6 +1470,27 @@ RSpec.describe Imports::LettingsLogsImportService do
end end
end end
context "and the provider type doesn't match the org" do
let(:invalid_lettings_log_id) { "c1bf33c5-f715-407a-840d-d6825554feca" }
let(:valid_lettings_log_id) { "0a36f37c-11aa-48ef-854e-8ce8d9bccd9f" }
let(:lettings_log_file) { open_file(fixture_directory, invalid_lettings_log_id) }
let(:lettings_log_xml) { Nokogiri::XML(lettings_log_file) }
around do |example|
Timecop.freeze(Time.zone.local(2023, 8, 24)) do
Singleton.__init__(FormHandler)
example.run
end
Timecop.return
Singleton.__init__(FormHandler)
end
it "does not error" do
expect { lettings_log_service.send(:create_log, lettings_log_xml) }
.not_to raise_error
end
end
context "when setting location fields for 23/24 logs" do context "when setting location fields for 23/24 logs" do
let(:lettings_log_id) { "00d2343e-d5fa-4c89-8400-ec3854b0f2b4" } let(:lettings_log_id) { "00d2343e-d5fa-4c89-8400-ec3854b0f2b4" }
let(:lettings_log_file) { open_file(fixture_directory, lettings_log_id) } let(:lettings_log_file) { open_file(fixture_directory, lettings_log_id) }

5
spec/services/imports/organisation_import_service_spec.rb

@ -15,8 +15,8 @@ RSpec.describe Imports::OrganisationImportService do
doc.at_xpath("//institution:visible-id").content = visible_id if visible_id doc.at_xpath("//institution:visible-id").content = visible_id if visible_id
doc.at_xpath("//institution:name").content = name if name doc.at_xpath("//institution:name").content = name if name
else else
doc.at_xpath("//dclg:visible-id", {'dclg' => 'dclg:institution'}).content = visible_id if visible_id doc.at_xpath("//dclg:visible-id", { "dclg" => "dclg:institution" }).content = visible_id if visible_id
doc.at_xpath("//dclg:name", {'dclg' => 'dclg:institution'}).content = name if name doc.at_xpath("//dclg:name", { "dclg" => "dclg:institution" }).content = name if name
end end
StringIO.new(doc.to_xml) StringIO.new(doc.to_xml)
@ -150,5 +150,4 @@ RSpec.describe Imports::OrganisationImportService do
expect(Organisation).to exist(old_visible_id: "2") expect(Organisation).to exist(old_visible_id: "2")
end end
end end
end end

Loading…
Cancel
Save