Sha256: 7c36ac2196b15adc36d45523f1b24f765fbe7c97edf819031be42c042a4c1b8d

Contents?: true

Size: 748 Bytes

Versions: 1

Compression:

Stored size: 748 Bytes

Contents

require 'abstract_unit'

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

  def use_embedded_style_tag
    mail_with_defaults do |format|
      format.html { render(:inline => "<%= embedded_style_tag %>") }
    end
  end

  protected

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

class InlineCssHelperTest < ActionMailer::TestCase
  def test_embedded_style_tag
    css = "body { display: none; }"
    File.stubs(:exist?).returns(true)
    File.stubs(:read).returns(css)
    mail = HelperMailer.use_embedded_style_tag
    assert_match "<style type=\"text/css\">#{css}</style>", mail.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_helper_test.rb