diff --git a/docs/configuration.md b/docs/configuration.md
index 86c1fa3..6257063 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -74,8 +74,8 @@ In order of precedence Errbit uses:
OAuth scope to request from users when they sign-in through github
defaults to [repo]
EMAIL_DELIVERY_METHOD
-SMTP or sendmail, depending on how you want Errbit to send email
-defaults to sendmail
+:smtp or :sendmail, depending on how you want Errbit to send email
+defaults to :sendmail
SMTP_SERVER
Server address for outgoing SMTP messages
SMTP_PORT
diff --git a/spec/initializers/action_mailer_spec.rb b/spec/initializers/action_mailer_spec.rb
new file mode 100644
index 0000000..50afff7
--- /dev/null
+++ b/spec/initializers/action_mailer_spec.rb
@@ -0,0 +1,43 @@
+describe 'initializers/action_mailer' do
+ def load_initializer
+ load File.join(Rails.root, 'config', 'initializers', 'action_mailer.rb')
+ end
+
+ describe 'delivery method' do
+ it 'sets the delivery method to :smtp' do
+ allow(Errbit::Config).to receive(:email_delivery_method).and_return(:smtp)
+ load_initializer
+
+ expect(ActionMailer::Base.delivery_method).to be(:smtp)
+ end
+
+ it 'sets the delivery method to :sendmail' do
+ allow(Errbit::Config).to receive(:email_delivery_method).and_return(:sendmail)
+ load_initializer
+
+ expect(ActionMailer::Base.delivery_method).to be(:sendmail)
+ end
+ end
+
+ describe 'smtp settings' do
+ it 'lets smtp settings be set' do
+ allow(Errbit::Config).to receive(:email_delivery_method).and_return(:smtp)
+ allow(Errbit::Config).to receive(:smtp_address).and_return('smtp.somedomain.com')
+ allow(Errbit::Config).to receive(:smtp_port).and_return(998)
+ allow(Errbit::Config).to receive(:smtp_authentication).and_return(:login)
+ allow(Errbit::Config).to receive(:smtp_user_name).and_return('my-username')
+ allow(Errbit::Config).to receive(:smtp_password).and_return('my-password')
+ allow(Errbit::Config).to receive(:smtp_domain).and_return('someotherdomain.com')
+ load_initializer
+
+ expect(ActionMailer::Base.smtp_settings).to eq({
+ address: 'smtp.somedomain.com',
+ port: 998,
+ authentication: :login,
+ user_name: 'my-username',
+ password: 'my-password',
+ domain: 'someotherdomain.com',
+ })
+ end
+ end
+end
--
libgit2 0.21.2