Skip to content

Commit

Permalink
fix specs for all ruby versions
Browse files Browse the repository at this point in the history
  • Loading branch information
ylecuyer committed Dec 28, 2024
1 parent 1cf751c commit 738ac8c
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions spec/cases/http_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -238,17 +238,25 @@ def adapter(arg)
it 'logs tokens' do
allow(Koala.config).to receive(:mask_tokens) { false }

expect(Koala::Utils).to receive(:debug).with('STARTED => GET: /foo params: {"an" => :arg, "access_token" => "myvisbleaccesstoken"}')
expect(Koala::Utils).to receive(:debug).with('FINISHED => GET: /foo params: {"an" => :arg, "access_token" => "myvisbleaccesstoken"}')
expect(Koala::Utils).to receive(:debug) do |log|
expect(log).to match(/STARTED => GET: \/foo params: {"an"\s?=>\s?:arg, "access_token"\s?=>\s?"myvisbleaccesstoken"}/)
end
expect(Koala::Utils).to receive(:debug) do |log|
expect(log).to match(/FINISHED => GET: \/foo params: {"an"\s?=>\s?:arg, "access_token"\s?=>\s?"myvisbleaccesstoken"}/)
end

Koala::HTTPService.make_request(request)
end

it 'doesnt log tokens' do
allow(Koala.config).to receive(:mask_tokens) { true }

expect(Koala::Utils).to receive(:debug).with('STARTED => GET: /foo params: {"an" => :arg, "access_token" => "myvisbleac*****token"}')
expect(Koala::Utils).to receive(:debug).with('FINISHED => GET: /foo params: {"an" => :arg, "access_token" => "myvisbleac*****token"}')
expect(Koala::Utils).to receive(:debug) do |log|
expect(log).to match(/STARTED => GET: \/foo params: {"an"\s?=>\s?:arg, "access_token"\s?=>\s?"myvisbleac[*]{5}token"}/)
end
expect(Koala::Utils).to receive(:debug) do |log|
expect(log).to match(/FINISHED => GET: \/foo params: {"an"\s?=>\s?:arg, "access_token"\s?=>\s?"myvisbleac[*]{5}token"}/)
end

Koala::HTTPService.make_request(request)
end
Expand All @@ -258,8 +266,12 @@ def adapter(arg)

allow(Koala.config).to receive(:mask_tokens) { true }

expect(Koala::Utils).to receive(:debug).with('STARTED => GET: /debug_token params: {"input_token" => "myvisiblea*****token", "access_token" => "myvisiblea*****token"}')
expect(Koala::Utils).to receive(:debug).with('FINISHED => GET: /debug_token params: {"input_token" => "myvisiblea*****token", "access_token" => "myvisiblea*****token"}')
expect(Koala::Utils).to receive(:debug) do |log|
expect(log).to match(/STARTED => GET: \/debug_token params: {"input_token"\s?=>\s?"myvisiblea[*]{5}token", "access_token"\s?=>\s?"myvisiblea[*]{5}token"}/)
end
expect(Koala::Utils).to receive(:debug) do |log|
expect(log).to match(/FINISHED => GET: \/debug_token params: {"input_token"\s?=>\s?"myvisiblea[*]{5}token", "access_token"\s?=>\s?"myvisiblea[*]{5}token"}/)
end

Koala::HTTPService.make_request(request)
end
Expand Down

0 comments on commit 738ac8c

Please sign in to comment.