diff --git a/lib/qualtrics_api/response_export.rb b/lib/qualtrics_api/response_export.rb index a8696db..57651ac 100644 --- a/lib/qualtrics_api/response_export.rb +++ b/lib/qualtrics_api/response_export.rb @@ -34,7 +34,7 @@ def file_url def open(&block) raise QualtricsAPI::FileNotReadyError, "Cannot open exported file because the file url is missing." if file_url.nil? - Kernel.open(file_url, **QualtricsAPI.connection(self).headers, &block) + URI.open(file_url, **QualtricsAPI.connection(self).headers, &block) end end end diff --git a/spec/lib/response_export_spec.rb b/spec/lib/response_export_spec.rb index 4aa9416..4a24ce1 100644 --- a/spec/lib/response_export_spec.rb +++ b/spec/lib/response_export_spec.rb @@ -109,7 +109,7 @@ it "conforms to ruby 3 keyword-argument format" do subject.instance_variable_set(:@file_url, "some_url") - expect(Kernel).to receive(:open) do |*args, **kwargs| + expect(URI).to receive(:open) do |*args, **kwargs| expect(args).to eq ["some_url"] expect(kwargs.class).to eq Faraday::Utils::Headers end @@ -128,7 +128,7 @@ end it "opens the linked file with the file_url and qualtrics connection" do - expect(Kernel).to receive(:open).with("some_url", connection_headers) + expect(URI).to receive(:open).with("some_url", connection_headers) subject.open end end