From a06e5e7eb90206844fb21b317f1f923a527b3087 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 1 Nov 2015 12:57:55 +0100 Subject: Use mailcatcher to test emails during development. --- Gemfile | 1 + Gemfile.lock | 30 ++++++++++++++++++++++++++++++ lib/registration.rb | 3 +++ 3 files changed, 34 insertions(+) diff --git a/Gemfile b/Gemfile index 519fcbb..28417ca 100644 --- a/Gemfile +++ b/Gemfile @@ -12,6 +12,7 @@ group :development, :test do gem "rack-test" gem "capybara" gem "selenium-webdriver" + gem "mailcatcher" end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index c4a3bbf..812e550 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,12 @@ GEM remote: https://rubygems.org/ specs: + activesupport (4.2.4) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) backports (3.6.6) byebug (6.0.2) capistrano (3.4.0) @@ -24,13 +30,25 @@ GEM childprocess (0.5.6) ffi (~> 1.0, >= 1.0.11) colorize (0.7.7) + daemons (1.2.3) diff-lcs (1.2.5) + eventmachine (1.0.5) ffi (1.9.10) i18n (0.7.0) + json (1.8.3) mail (2.6.3) mime-types (>= 1.16, < 3) + mailcatcher (0.6.1) + activesupport (>= 4.0.0, < 5) + eventmachine (~> 1.0.0, <= 1.0.5) + mail (~> 2.3) + sinatra (~> 1.2) + skinny (~> 0.2.3) + sqlite3 (~> 1.3) + thin (~> 1.5.0) mime-types (2.6.2) mini_portile (0.6.2) + minitest (5.8.2) multi_json (1.11.2) net-scp (1.2.1) net-ssh (>= 2.6.5) @@ -81,12 +99,23 @@ GEM tilt (>= 1.3, < 3) sinatra-url-for (0.2.2.1) sinatra (>= 0.9.1.1) + skinny (0.2.3) + eventmachine (~> 1.0.0) + thin (~> 1.5.0) + sqlite3 (1.3.11) sshkit (1.7.1) colorize (>= 0.7.0) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) + thin (1.5.1) + daemons (>= 1.0.9) + eventmachine (>= 0.12.6) + rack (>= 1.0.0) + thread_safe (0.3.5) tilt (2.0.1) ttfunk (1.4.0) + tzinfo (1.2.2) + thread_safe (~> 0.1) websocket (1.2.2) xpath (2.0.0) nokogiri (~> 1.3) @@ -102,6 +131,7 @@ DEPENDENCIES capistrano-rvm capybara mail + mailcatcher prawn rack-test rspec diff --git a/lib/registration.rb b/lib/registration.rb index 5ace438..e576cb0 100644 --- a/lib/registration.rb +++ b/lib/registration.rb @@ -10,6 +10,9 @@ def send_registration_emails_for(band) mail.subject = "Registrering av band #{@band.name} til Norsk Urskog" mail.body = 'Neijassådu!' + if settings.environment != :test && settings.smtp + mail.delivery_method :smtp, :address => settings.smtp['address'], :port => settings.smtp['port'] + end mail.deliver! end -- cgit v1.2.3