Skip to content

Commit 0f2aa62

Browse files
committed
✅ Fix tests
1 parent f839c62 commit 0f2aa62

File tree

5 files changed

+18
-11
lines changed

5 files changed

+18
-11
lines changed

.rubocop_gradual.lock

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@
9797
"spec/oauth2/version_spec.rb:1001406821": [
9898
[3, 1, 30, "RSpec/SpecFilePathFormat: Spec path should end with `o_auth2/version*_spec.rb`.", 1099517182]
9999
],
100-
"spec/oauth2_spec.rb:438638294": [
101-
[3, 1, 21, "RSpec/SpecFilePathFormat: Spec path should end with `o_auth2*_spec.rb`.", 3359091140],
102-
[5, 68, 2, "RSpec/BeEq: Prefer `be` over `eq`.", 5860785]
100+
"spec/oauth2_spec.rb:245212644": [
101+
[3, 1, 21, "RSpec/SpecFilePathFormat: Spec path should end with `o_auth2*_spec.rb`.", 3359091140]
103102
]
104103
}

lib/oauth2/client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ def build_access_token_legacy(response, access_token_opts, extract_access_token)
449449
end
450450

451451
def oauth_debug_logging(builder)
452-
builder.response(:logger, options[:logger], bodies: true) if OAUTH_DEBUG
452+
builder.response(:logger, options[:logger], bodies: true) if OAuth2::OAUTH_DEBUG
453453
end
454454
end
455455
end

spec/oauth2/access_token_spec.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@
5151
end
5252

5353
before do
54-
stub_const("OAuth2::OAUTH_DEBUG", true)
54+
@original_setw = OAuth2.config.silence_extra_tokens_warning
55+
OAuth2.config.silence_extra_tokens_warning = false
56+
end
57+
58+
after do
59+
OAuth2.config.silence_extra_tokens_warning = @original_setw
5560
end
5661

5762
it "warns on STDERR" do
@@ -94,7 +99,12 @@
9499
end
95100

96101
before do
97-
stub_const("OAuth2::OAUTH_DEBUG", true)
102+
@original_setw = OAuth2.config.silence_extra_tokens_warning
103+
OAuth2.config.silence_extra_tokens_warning = false
104+
end
105+
106+
after do
107+
OAuth2.config.silence_extra_tokens_warning = @original_setw
98108
end
99109

100110
let(:hash) do

spec/oauth2/client_spec.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,7 @@
356356
expect(response.headers).to eq("Content-Type" => "text/awesome")
357357
end
358358

359-
context "with ENV" do
360-
context "when OAUTH_DEBUG=true" do
359+
context "when silence_extra_tokens_warning=false" do
361360
before do
362361
stub_const("OAuth2::OAUTH_DEBUG", true)
363362
end
@@ -374,7 +373,6 @@
374373
expect(output).to include(*logs)
375374
end
376375
end
377-
end
378376

379377
it "posts a body" do
380378
response = subject.request(:post, "/reflect", body: "foo=bar")

spec/oauth2_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# frozen_string_literal: true
22

33
RSpec.describe OAuth2 do
4-
it "has a default config for silence_extra_tokens_warning" do
5-
expect(described_class.config.silence_extra_tokens_warning).to eq(true)
4+
it "silence_extra_tokens_warning default is opposite of OAUTH_DEBUG" do
5+
expect(described_class.config.silence_extra_tokens_warning).to eq(!OAuth2::OAUTH_DEBUG)
66
end
77

88
describe ".configure" do

0 commit comments

Comments
 (0)