Sha256: f30eb1a2541c16ae3cf706fccdbebf73134c32e4a405684c0602b32bd416ec56

Contents?: true

Size: 984 Bytes

Versions: 1

Compression:

Stored size: 984 Bytes

Contents

require 'abstract_unit'

ENV["RAILS_ASSET_ID"] = "123456"

class HelperMailer < ActionMailer::Base
  def use_stylesheet_link_tag
    mail_with_defaults do |format|
      format.html { render(:inline => %Q{
        <html>
          <head>
            <%= stylesheet_link_tag 'mailers/mailer' %>
          </head>
          <body>
            <div class="test">Test</div>
          </body>
        </html>
      }) }
    end
  end

  protected

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

class PremailerStylesheetLinkTagTest < ActionMailer::TestCase
  def test_premailer_stylesheet_link_tag
    css_file = "div.test { color: #119911; }"
    File.stubs(:exist?).returns(true)
    File.stubs(:read).returns(css_file)

    mail = HelperMailer.use_stylesheet_link_tag.deliver
    assert_match "<div class=\"test\" style=\"color: #119911;\">", mail.html_part.decoded
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
actionmailer_inline_css-1.3.0 test/premailer_stylesheet_link_tag_test.rb