Skip to content

Commit 5d0d9c7

Browse files
author
Austin Schneider
committed
reorg files
1 parent de37477 commit 5d0d9c7

File tree

14 files changed

+26
-24
lines changed

14 files changed

+26
-24
lines changed

app/mailers/alert_mailer.rb

Lines changed: 0 additions & 20 deletions
This file was deleted.

lib/pinger/alert/mailer.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
class Alert
2+
class Mailer < ActionMailer::Base
3+
4+
default from: "[email protected]"
5+
6+
# Subject can be set in your I18n file at config/locales/en.yml
7+
# with the following lookup:
8+
#
9+
# en.email_callback_mailer.notification.subject
10+
#
11+
def notification(alert)
12+
@location_title = alert.location.title
13+
@correct_status_code = alert.code_is_not
14+
15+
mail(
16+
to: alert.email_callback.to,
17+
subject: t('email_callback_mailer.notification.subject', location_title: @location_title)
18+
)
19+
end
20+
21+
end
22+
end

lib/pinger/alert/record.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ def conditions_met?
2727
end
2828

2929
def deliver!
30-
AlertMailer.notification(self).deliver
30+
Mailer.notification(self).deliver
3131
end
3232

3333
def to_presenter(view)
34-
Alert::Presenter.new self, view
34+
Presenter.new self, view
3535
end
3636

3737
end
File renamed without changes.
File renamed without changes.
File renamed without changes.

spec/mailers/alert_mailer_spec.rb renamed to spec/lib/pinger/alert/mailer_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require "spec_helper"
22

3-
describe AlertMailer do
3+
describe Alert::Mailer do
44

55
describe "notification" do
66
subject { described_class.notification(alert) }

spec/lib/pinger/alert_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
describe "deliver!" do
4545
it "tells a notification email to deliver" do
4646
notif = mock Mail::Message, deliver: nil
47-
AlertMailer.stub(:notification) { |a| notif if a == subject }
47+
Alert::Mailer.stub(:notification) { |a| notif if a == subject }
4848

4949
notif.should_receive :deliver
5050
subject.deliver!
File renamed without changes.

0 commit comments

Comments
 (0)