Skip to content

Commit

Permalink
add gems for testing and development emails correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
raul-fuentes committed Dec 7, 2017
1 parent 2a4b9b0 commit 31a64e6
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ group :development do
gem 'capistrano-rails-console', require: false
gem 'capistrano-rvm', '~> 0.1.1', require: false
gem 'jazz_hands', :git => 'https://github.com/nixme/jazz_hands.git', branch: 'bring-your-own-debugger'
gem 'letter_opener_web', '~> 1.3.1'
gem 'quiet_assets', '~> 1.1.0'
gem 'rails_layout', '~> 1.0.26'
gem 'spring-commands-rspec', '~> 1.0.4'
Expand All @@ -64,6 +65,7 @@ end

group :test do
gem 'capybara', '~> 2.5.0'
gem 'capybara-email', '~> 2.5.0'
gem 'coveralls', require: false
gem 'database_cleaner', '~> 1.5.0'
gem 'launchy', '~> 2.4.3'
Expand Down
11 changes: 11 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ GEM
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
capybara-email (2.5.0)
capybara (~> 2.4)
mail
climate_control (0.2.0)
cliver (0.3.2)
cocaine (0.5.8)
Expand Down Expand Up @@ -199,6 +202,12 @@ GEM
kgio (2.10.0)
launchy (2.4.3)
addressable (~> 2.3)
letter_opener (1.4.1)
launchy (~> 2.2)
letter_opener_web (1.3.1)
actionmailer (>= 3.2)
letter_opener (~> 1.0)
railties (>= 3.2)
loofah (2.1.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
Expand Down Expand Up @@ -459,6 +468,7 @@ DEPENDENCIES
capistrano-rails-console
capistrano-rvm (~> 0.1.1)
capybara (~> 2.5.0)
capybara-email (~> 2.5.0)
cocoon (~> 1.2.6)
coffee-rails (~> 4.1.0)
coveralls
Expand All @@ -478,6 +488,7 @@ DEPENDENCIES
jquery-validation-rails (~> 1.13.1)
kaminari (~> 1.0.1)
launchy (~> 2.4.3)
letter_opener_web (~> 1.3.1)
newrelic_rpm (~> 3.13.2.302)
paperclip (~> 4.3, >= 4.3.7)
pg (~> 0.18.3)
Expand Down
1 change: 1 addition & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@

# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
config.action_mailer.delivery_method = :letter_opener_web
end
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@
resources :agents, only: :index, format: :json
end

mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development?

end
18 changes: 18 additions & 0 deletions spec/features/mailer/events_mailer_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
feature 'Events Mailer' do

describe "Cancel Event" do

background do
clear_emails
@event = create(:event, title: 'New event from Capybara', user: create(:user))
@event.cancel = 'true'
@event.save!
open_email(@event.user.email)
end

scenario 'cancel event mail' do
expect(current_email).to have_content I18n.t('mailers.cancel_event.text1', title: @event.title)
end

end
end
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'coveralls'
Coveralls.wear!('rails')
require 'simplecov'
require 'capybara/email/rspec'

SimpleCov.start

Expand Down

0 comments on commit 31a64e6

Please sign in to comment.