Skip to content

Commit 9112baa

Browse files
committed
✅ Add test for invalid mode via callable
1 parent 53e53c0 commit 9112baa

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

.rubocop_gradual.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
"lib/oauth2/response.rb:2054901929": [
2222
[53, 5, 204, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 996912427]
2323
],
24-
"spec/oauth2/access_token_spec.rb:373808463": [
24+
"spec/oauth2/access_token_spec.rb:3464059918": [
2525
[3, 1, 34, "RSpec/SpecFilePathFormat: Spec path should end with `o_auth2/access_token*_spec.rb`.", 1972107547],
26-
[809, 13, 25, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 770233088],
27-
[879, 9, 101, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 3022740639],
28-
[883, 9, 79, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2507338967]
26+
[824, 13, 25, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 770233088],
27+
[894, 9, 101, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 3022740639],
28+
[898, 9, 79, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2507338967]
2929
],
3030
"spec/oauth2/authenticator_spec.rb:853320290": [
3131
[3, 1, 36, "RSpec/SpecFilePathFormat: Spec path should end with `o_auth2/authenticator*_spec.rb`.", 819808017],

spec/oauth2/access_token_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,21 @@ def assert_initialized_token(target)
429429
expect(subject.__send__(verb, "/token/#{mode.call(verb)}").body).to include(token)
430430
end
431431
end
432+
433+
context "when invalid" do
434+
subject(:invalid_target) { target.__send__(http_verb, "/token/#{mode.call(http_verb)}") }
435+
436+
let(:http_verb) { :get }
437+
let(:mode) do
438+
lambda do |_verb|
439+
"foobar"
440+
end
441+
end
442+
443+
it "correctly handles an invalid mode by raising an error" do
444+
block_is_expected.to raise_error("invalid :mode option of foobar")
445+
end
446+
end
432447
end
433448

434449
context "with client.options[:raise_errors] = false" do

0 commit comments

Comments
 (0)