mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-26 07:22:30 +00:00
Fix OmniAuth tests (#29201)
This commit is contained in:
parent
8e8e0f104f
commit
bbbbf00084
|
@ -39,6 +39,13 @@ describe 'OmniAuth callbacks' do
|
||||||
Fabricate(:user, email: 'user@host.example')
|
Fabricate(:user, email: 'user@host.example')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when ALLOW_UNSAFE_AUTH_PROVIDER_REATTACH is set to true' do
|
||||||
|
around do |example|
|
||||||
|
ClimateControl.modify ALLOW_UNSAFE_AUTH_PROVIDER_REATTACH: 'true' do
|
||||||
|
example.run
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
it 'matches the existing user, creates an identity, and redirects to root path' do
|
it 'matches the existing user, creates an identity, and redirects to root path' do
|
||||||
expect { subject }
|
expect { subject }
|
||||||
.to not_change(User, :count)
|
.to not_change(User, :count)
|
||||||
|
@ -52,6 +59,16 @@ describe 'OmniAuth callbacks' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when ALLOW_UNSAFE_AUTH_PROVIDER_REATTACH is not set to true' do
|
||||||
|
it 'does not match the existing user or create an identity' do
|
||||||
|
expect { subject }
|
||||||
|
.to not_change(User, :count)
|
||||||
|
.and not_change(Identity, :count)
|
||||||
|
.and not_change(LoginActivity, :count)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'with a matching user and a matching identity' do
|
context 'with a matching user and a matching identity' do
|
||||||
before do
|
before do
|
||||||
user = Fabricate(:user, email: 'user@host.example')
|
user = Fabricate(:user, email: 'user@host.example')
|
||||||
|
|
Loading…
Reference in a new issue