Skip to content

Commit

Permalink
Merged in feature/integrate_mailtrap_instead_of_letter_opener (pull r…
Browse files Browse the repository at this point in the history
…equest #36)

KBP-171 #time 2h - integrate mailtrap instead of letter_opener

Approved-by: İsmail Akbudak <[email protected]>
  • Loading branch information
Fadime Özhan authored and İsmail Akbudak committed Dec 12, 2017
2 parents 2abdbfc + b7014b2 commit ff613ce
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/cybele/generators/app_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def configure_mail_setting
say 'Setup mail settings'
build :configure_action_mailer
build :configure_smtp
build :setup_letter_opener
build :setup_mailtrap
end

def gitignore_files_and_folders
Expand Down
5 changes: 3 additions & 2 deletions lib/cybele/helpers/mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ def configure_smtp
append_file 'config/settings.yml', template_content('mailer/mailer_settings.yml.erb')
end

def setup_letter_opener
configure_environment 'development', template_content('mailer/letter_opener.rb.erb')
def setup_mailtrap
configure_environment 'development', template_content('mailer/smtp.rb.erb')
append_file('.env.local', "\n\n#{template_content('mailer/.env.local.erb')}")
end
end
end
Expand Down
7 changes: 2 additions & 5 deletions spec/features/new_default_project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,15 @@

it 'uses mailer' do
gemfile_file = content('Gemfile')
expect(gemfile_file).to match("gem 'letter_opener'")
expect(gemfile_file).to match("gem 'mailtrap'")

expect(File).to exist(file_project_path('config/settings/production.yml'))
expect(File).to exist(file_project_path('config/settings/staging.yml'))

mail_test_helper('config/settings.yml')
mail_test_helper('config/environments/production.rb')
mail_test_helper('config/environments/staging.rb')

development_file = content('config/environments/development.rb')
expect(development_file).to match('host:')
expect(development_file).to match(':letter_opener')
mail_test_helper('config/environments/development.rb')
end

it 'uses haml' do
Expand Down
7 changes: 2 additions & 5 deletions spec/features/new_not_default_project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,18 +162,15 @@

it 'uses mailer' do
gemfile_file = content('Gemfile')
expect(gemfile_file).to match("gem 'letter_opener'")
expect(gemfile_file).to match("gem 'mailtrap'")

expect(File).to exist(file_project_path('config/settings/production.yml'))
expect(File).to exist(file_project_path('config/settings/staging.yml'))

mail_test_helper('config/settings.yml')
mail_test_helper('config/environments/production.rb')
mail_test_helper('config/environments/staging.rb')

development_file = content('config/environments/development.rb')
expect(development_file).to match('host:')
expect(development_file).to match(':letter_opener')
mail_test_helper('config/environments/development.rb')
end

it 'do not use haml' do
Expand Down
2 changes: 1 addition & 1 deletion templates/Gemfile.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ group :development, :test do
gem 'colorize', '~> 0.8.1'
gem 'better_errors', '~> 2.4'
gem 'bullet', '~> 5.6', '>= 5.6.1'
gem 'letter_opener', '~> 1.4', '>= 1.4.1'
gem 'mailtrap', '~> 0.2.1'
gem 'pronto', '~> 0.9.5'
gem 'pronto-flay', '~> 0.9.0', require: false
gem 'pronto-rubocop', '~> 0.9.0', require: false
Expand Down
6 changes: 6 additions & 0 deletions templates/mailer/.env.local.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SMTP Get username and password from https://mailtrap.io
SMTP_USER_NAME=
SMTP_PASSWORD=
SMTP_PORT=2525
SMTP_ADDRESS=smtp.mailtrap.io
SMTP_AUTHENTICATION=cram_md5
1 change: 0 additions & 1 deletion templates/mailer/letter_opener.rb.erb

This file was deleted.

0 comments on commit ff613ce

Please sign in to comment.