Commit bd06936c161872b3a8f784f52daeb700881baeb9
1 parent
2bdb49ac
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Set the asset host for person notifier mailing
Showing
3 changed files
with
3 additions
and
39 deletions
Show diff stats
app/helpers/person_notifier_helper.rb
app/models/person_notifier.rb
... | ... | @@ -67,13 +67,15 @@ class PersonNotifier |
67 | 67 | |
68 | 68 | class Mailer < ActionMailer::Base |
69 | 69 | |
70 | - add_template_helper(PersonNotifierHelper) | |
70 | + add_template_helper(ApplicationHelper) | |
71 | 71 | |
72 | 72 | def session |
73 | 73 | {:theme => nil} |
74 | 74 | end |
75 | 75 | |
76 | 76 | def content_summary(person, notifications) |
77 | + ActionMailer::Base.asset_host = person.environment.top_url if person.environment | |
78 | + | |
77 | 79 | @current_theme = 'default' |
78 | 80 | @profile = person |
79 | 81 | @recipient = @profile.nickname || @profile.name | ... | ... |
test/unit/person_notifier_helper_test.rb
... | ... | @@ -1,23 +0,0 @@ |
1 | -require File.dirname(__FILE__) + '/../test_helper' | |
2 | - | |
3 | -class PersonNotifierHelperTest < ActionView::TestCase | |
4 | - | |
5 | - include PersonNotifierHelper | |
6 | - | |
7 | - def setup | |
8 | - @profile = mock | |
9 | - @env = Environment.new | |
10 | - end | |
11 | - attr_reader :profile, :env | |
12 | - | |
13 | - should 'append top url of environment at image path' do | |
14 | - profile.expects(:environment).returns(env).at_least_once | |
15 | - assert_match /src="http:\/\/localhost\/image.png"/, image_tag("/image.png") | |
16 | - end | |
17 | - | |
18 | - should 'return original path if do not have an environment' do | |
19 | - profile.expects(:environment).returns(nil).at_least_once | |
20 | - assert_match /src="\/image.png"/, image_tag("/image.png") | |
21 | - end | |
22 | - | |
23 | -end |