mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
Add warning on admin dashboard if production env is configured to send email through gmail
This commit is contained in:
@ -121,9 +121,32 @@ describe AdminDashboardData do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'send_email_with_gmail_check' do
|
||||
subject { AdminDashboardData.new.send_email_with_gmail_check }
|
||||
|
||||
it 'returns nil if gmail.com is not in the smtp_settings address' do
|
||||
ActionMailer::Base.stubs(:smtp_settings).returns({address: 'mandrillapp.com'})
|
||||
expect(subject).to be_nil
|
||||
end
|
||||
|
||||
context 'gmail.com is in the smtp_settings address' do
|
||||
before { ActionMailer::Base.stubs(:smtp_settings).returns({address: 'smtp.gmail.com'}) }
|
||||
|
||||
it 'returns nil in development env' do
|
||||
Rails.stubs(:env).returns('development')
|
||||
expect(subject).to be_nil
|
||||
end
|
||||
|
||||
it 'returns a string when in production env' do
|
||||
Rails.stubs(:env).returns('production')
|
||||
expect(subject).to_not be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'auth_config_checks' do
|
||||
|
||||
shared_examples_for 'problem detection for login providers' do
|
||||
shared_examples 'problem detection for login providers' do
|
||||
context 'when disabled' do
|
||||
it 'returns nil' do
|
||||
SiteSetting.stubs(enable_setting).returns(false)
|
||||
@ -167,7 +190,7 @@ describe AdminDashboardData do
|
||||
let(:enable_setting) { :enable_facebook_logins }
|
||||
let(:key) { :facebook_app_id }
|
||||
let(:secret) { :facebook_app_secret }
|
||||
it_should_behave_like 'problem detection for login providers'
|
||||
include_examples 'problem detection for login providers'
|
||||
end
|
||||
|
||||
describe 'twitter' do
|
||||
@ -175,7 +198,7 @@ describe AdminDashboardData do
|
||||
let(:enable_setting) { :enable_twitter_logins }
|
||||
let(:key) { :twitter_consumer_key }
|
||||
let(:secret) { :twitter_consumer_secret }
|
||||
it_should_behave_like 'problem detection for login providers'
|
||||
include_examples 'problem detection for login providers'
|
||||
end
|
||||
|
||||
describe 'github' do
|
||||
@ -183,7 +206,7 @@ describe AdminDashboardData do
|
||||
let(:enable_setting) { :enable_github_logins }
|
||||
let(:key) { :github_client_id }
|
||||
let(:secret) { :github_client_secret }
|
||||
it_should_behave_like 'problem detection for login providers'
|
||||
include_examples 'problem detection for login providers'
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user