forked from mbleigh/omniauth-jwt
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Support OpenSSL (ripped from gitlabhq fork)
- OpenSSL::PKey::RSA - RS256 - RS384 - RS512 - OpenSSL::PKey::EC - ES256 - ES384 - ES512
- Loading branch information
Showing
6 changed files
with
219 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class Hash | ||
def self.stringify_keys(h) | ||
h.is_a?(Hash) ? h.collect{|k,v| [k.to_s, stringify_keys(v)]}.to_h : h | ||
end | ||
|
||
def stringify_keys | ||
self.class.stringify_keys(self) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# From: https://github.com/gitlabhq/gitlabhq/blob/master/gems/gitlab-rspec/lib/gitlab/rspec/next_instance_of.rb#L4 | ||
module NextInstanceOf | ||
def expect_next_instance_of(klass, *new_args, &blk) | ||
stub_new(expect(klass), nil, false, *new_args, &blk) | ||
end | ||
|
||
def expect_next_instances_of(klass, number, ordered = false, *new_args, &blk) | ||
stub_new(expect(klass), number, ordered, *new_args, &blk) | ||
end | ||
|
||
def allow_next_instance_of(klass, *new_args, &blk) | ||
stub_new(allow(klass), nil, false, *new_args, &blk) | ||
end | ||
|
||
def allow_next_instances_of(klass, number, ordered = false, *new_args, &blk) | ||
stub_new(allow(klass), number, ordered, *new_args, &blk) | ||
end | ||
|
||
private | ||
|
||
def stub_new(target, number, ordered = false, *new_args, &blk) | ||
receive_new = receive(:new) | ||
receive_new.ordered if ordered | ||
receive_new.with(*new_args) if !(new_args.empty? || new_args.blank?) | ||
|
||
if number.is_a?(Range) | ||
receive_new.at_least(number.begin).times if number.begin | ||
receive_new.at_most(number.end).times if number.end | ||
elsif number | ||
receive_new.exactly(number).times | ||
end | ||
|
||
target.to receive_new.and_wrap_original do |*original_args, **original_kwargs| | ||
method, *original_args = original_args | ||
method.call(*original_args, **original_kwargs).tap(&blk) | ||
end | ||
end | ||
end |