Sha256: 06717bb83bdf83090b2fe30b0515cf80ddb505badb4fa21c9e30a0fba6c3c1b7

Contents?: true

Size: 1017 Bytes

Versions: 4

Compression:

Stored size: 1017 Bytes

Contents

require File.dirname(__FILE__) + '/../test_helper'
require '<%= file_name %>'

class <%= class_name %>Test < Test::Unit::TestCase
  FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures'
  CHARSET = "utf-8"

  include ActionMailer::Quoting

  def setup
    ActionMailer::Base.delivery_method = :test
    ActionMailer::Base.perform_deliveries = true
    ActionMailer::Base.deliveries = []

    @expected = TMail::Mail.new
    @expected.set_content_type "text", "plain", { "charset" => CHARSET }
  end

<% for action in actions -%>
  def test_<%= action %>
    @expected.subject = encode '<%= class_name %>#<%= action %>'
    @expected.body    = read_fixture('<%= action %>')
    @expected.date    = Time.now

    assert_equal @expected.encoded, <%= class_name %>.create_<%= action %>(@expected.date).encoded
  end

<% end -%>
  private
    def read_fixture(action)
      IO.readlines("#{FIXTURES_PATH}/<%= file_name %>/#{action}")
    end

    def encode(subject)
      quoted_printable(subject, CHARSET)
    end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
rails-0.13.1 lib/rails_generator/generators/components/mailer/templates/unit_test.rb
rails-0.13.0 lib/rails_generator/generators/components/mailer/templates/unit_test.rb
rails_product-0.5 lib/rails_generator/generators/components/mailer/templates/unit_test.rb
rails_product-0.6 lib/rails_generator/generators/components/mailer/templates/unit_test.rb