cirandas.net

ref: master

test/unit/email_template_helper_test.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
require_relative "../test_helper"

class EmailTemplateHelperTest < ActionView::TestCase

  should 'replace body and subject with parsed values from template' do
    template = mock
    template.expects(:parsed_body).returns('parsed body')
    template.expects(:parsed_subject).returns('parsed subject')
    params = {:subject => 'subject', :body => 'body', :email_template => template}
    expects(:mail).with({:subject => 'parsed subject', :body => 'parsed body', :content_type => 'text/html'})
    mail_with_template(params)
  end

  should 'do not change params if there is no email template' do
    params = {:subject => 'subject', :body => 'body'}
    expects(:mail).with(params)
    mail_with_template(params)
  end

end