fix: Execute PAM authentication tests on CircleCI (#9029)

and use 'if' option of context block
This commit is contained in:
takayamaki 2018-10-21 00:28:04 +09:00 committed by Eugen Rochko
parent fd5285658f
commit 33976c8ecc
2 changed files with 43 additions and 42 deletions

View file

@ -13,6 +13,9 @@ aliases:
ALLOW_NOPAM: true ALLOW_NOPAM: true
CONTINUOUS_INTEGRATION: true CONTINUOUS_INTEGRATION: true
DISABLE_SIMPLECOV: true DISABLE_SIMPLECOV: true
PAM_ENABLED: true
PAM_DEFAULT_SERVICE: pam_test
PAM_CONTROLLED_SERVICE: pam_test_controlled
working_directory: ~/projects/mastodon/ working_directory: ~/projects/mastodon/
- &attach_workspace - &attach_workspace

View file

@ -55,8 +55,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
request.env['devise.mapping'] = Devise.mappings[:user] request.env['devise.mapping'] = Devise.mappings[:user]
end end
if ENV['PAM_ENABLED'] == 'true' context 'using PAM authentication', if: ENV['PAM_ENABLED'] == 'true' do
context 'using PAM authentication' do
context 'using a valid password' do context 'using a valid password' do
before do before do
post :create, params: { user: { email: "pam_user1", password: '123456' } } post :create, params: { user: { email: "pam_user1", password: '123456' } }
@ -106,7 +105,6 @@ RSpec.describe Auth::SessionsController, type: :controller do
end end
end end
end end
end
context 'using password authentication' do context 'using password authentication' do
let(:user) { Fabricate(:user, email: 'foo@bar.com', password: 'abcdefgh') } let(:user) { Fabricate(:user, email: 'foo@bar.com', password: 'abcdefgh') }