Sha256: e8b082490a6516872396dec0becb5512f4a7b78714dc950512f95d4833b7f6a3
Contents?: true
Size: 1.22 KB
Versions: 5
Compression:
Stored size: 1.22 KB
Contents
require 'spec_helper' describe LifenFhir::Logger do context "stand alone usage" do it "logs to a given IO" do stringio = StringIO.new log = LifenFhir::Logger.new(stringio) log.fatal("Une erreur est survenue") expect(stringio.string).to end_with("FATAL -- lifen_fhir: *** [LIFEN] Une erreur est survenue\n") end end context 'client usage' do let(:client) { LifenFhir::AppAuthenticatedClient.new } let(:stringio) { StringIO.new } before do LifenFhir.configure do |config| config.logger = Logger.new(stringio) end end it "logs to a given logger" do begin VCR.use_cassette "logger/invalid" do client.get("/invalid") end rescue LifenFhir::Error => e end expect(stringio.string).to end_with("FATAL -- : *** [LIFEN] 404 Error on GET 'https://develop.lifen.fr/invalid'\n") end context 'with a success response' do it "logs to a given logger with info level" do VCR.use_cassette "logger/valid" do client.get("/valid") end expect(stringio.string).to end_with("INFO -- : *** [LIFEN] Success on GET 'https://develop.lifen.fr/valid'\n") end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
lifen_fhir-0.7.1 | spec/logger_spec.rb |
lifen_fhir-0.7.0 | spec/logger_spec.rb |
lifen_fhir-0.6.1 | spec/logger_spec.rb |
lifen_fhir-0.6.0 | spec/logger_spec.rb |
lifen_fhir-0.5.0 | spec/logger_spec.rb |