Sha256: 4480559ec994a8ed6f2e37fe7f5d321808d43db97dc53d67164077315c84efe0

Contents?: true

Size: 827 Bytes

Versions: 1

Compression:

Stored size: 827 Bytes

Contents

require 'abstract_unit'

class HelperMailer < ActionMailer::Base
  helper ActionMailer::InlineCssHelper

  def use_inline_css_hook
    mail_with_defaults do |format|
      format.html { render(:inline => %Q{
<html>
  <head>
    <style>
      #test { color: #123456; }
    </style>
  </head>
  <body>
    <div id="test">Test</div>
  </body>
</html>
}) }
      format.text { render(:inline => "Text Part") }
    end
  end

  protected

  def mail_with_defaults(&block)
    mail(:to => "test@localhost", :from => "tester@example.com",
          :subject => "using helpers", &block)
  end
end

class InlineCssHookTest < ActionMailer::TestCase
  def test_inline_css_hook
    mail = HelperMailer.use_inline_css_hook.deliver
    assert_match '<div id="test" style="color: #123456;">Test</div>', mail.html_part.body.encoded
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
actionmailer_inline_css-1.0.3 test/inline_css_hook_test.rb