Skip to content
This repository has been archived by the owner on Jul 24, 2020. It is now read-only.

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sydney Young committed Oct 17, 2015
1 parent b31fed0 commit 5f1ca02
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions spec/mailers/user_mailer_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'spec_helper'
include EnvHelpers

shared_examples_for 'valid user email' do
it 'sends to the reserver' do
Expand Down Expand Up @@ -49,6 +50,19 @@
expect(ActionMailer::Base.deliveries.count).to eq(1)
end

it 'logs if the env is set' do
env_wrapper('LOG_EMAILS' => '1') do
expect(Rails.logger).to receive(:info).with(/Sent/).once
@mail = UserMailer.reservation_status_update(@res).deliver
end
end

it "doesn't log if the env is not set" do
expect(ENV['LOG_EMAILS']).to be_nil
expect(Rails.logger).to receive(:info).exactly(0).times
@mail = UserMailer.reservation_status_update(@res).deliver
end

it 'sends denied notifications' do
@res.update_attributes(status: 'denied')
expect(@res.denied?).to be_truthy
Expand Down

0 comments on commit 5f1ca02

Please sign in to comment.