forked from nanego/my-dcim
-
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.
- Loading branch information
1 parent
f1aacca
commit 58f9cae
Showing
10 changed files
with
22 additions
and
19 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
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 |
---|---|---|
@@ -1,12 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe Users::OmniauthCallbacksController, type: :controller do | ||
describe '#openid_connect' do | ||
|
||
before { | ||
before do | ||
@user = User.find_or_create_by(email: '[email protected]') | ||
puts @user.inspect | ||
} | ||
end | ||
|
||
it 'creates a new user with valid authentication' do | ||
request.env['devise.mapping'] = Devise.mappings[:user] | ||
|
@@ -24,9 +25,9 @@ | |
request.env['devise.mapping'] = Devise.mappings[:user] | ||
request.env['omniauth.auth'] = OmniAuth.config.mock_auth[:openid_connect_unknown_user] | ||
|
||
expect { | ||
expect do | ||
get :openid_connect | ||
}.not_to change(User, :count) | ||
end.not_to change(User, :count) | ||
|
||
expect(controller.current_user).to be_nil | ||
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 |
---|---|---|
@@ -1,16 +1,18 @@ | ||
# frozen_string_literal: true | ||
|
||
OmniAuth.config.test_mode = true | ||
|
||
OmniAuth.config.mock_auth[:openid_connect] = OmniAuth::AuthHash.new( | ||
provider: :openid_connect, | ||
uid: 'user_unique_id', | ||
info: { | ||
email: '[email protected]', | ||
name: 'John Doe', | ||
name: 'John Doe' | ||
# Add other user information as needed for your tests | ||
}, | ||
credentials: { | ||
token: 'valid_access_token', | ||
expires_at: Time.now + 1.hour | ||
expires_at: Time.zone.now + 1.hour | ||
} | ||
) | ||
|
||
|
@@ -21,10 +23,10 @@ | |
uid: 'user_unique_id', | ||
info: { | ||
email: '[email protected]', | ||
name: 'Unknown User', | ||
name: 'Unknown User' | ||
}, | ||
credentials: { | ||
token: 'valid_access_token', | ||
expires_at: Time.now + 1.hour | ||
expires_at: Time.zone.now + 1.hour | ||
} | ||
) |
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