Sha256: 048344d82e43ea8e1d74aa4dadff1e8acfdee069f87da90779f98a5ff0a218a4

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

require 'test_helper'
require 'lib/generators/haml/testing_helper'

class Haml::Generators::MailerGeneratorTest < Rails::Generators::TestCase
  destination File.join(Rails.root)
  tests Rails::Generators::MailerGenerator
  arguments %w(notifier foo bar --template-engine haml)

  setup :prepare_destination
  setup :copy_routes

  test "should invoke template engine" do
    run_generator

    assert_file "app/views/layouts/mailer.text.haml" do |view|
      assert_match /\= yield/, view
    end

    assert_file "app/views/layouts/mailer.html.haml" do |view|
      assert_match /\= yield/, view
    end

    assert_file "app/views/notifier/foo.text.haml" do |view|
      assert_match %r(app/views/notifier/foo\.text\.haml), view
      assert_match /\= @greeting/, view
    end

    assert_file "app/views/notifier/foo.html.haml" do |view|
      assert_match %r(app/views/notifier/foo\.html\.haml), view
      assert_match /\= @greeting/, view
    end

    assert_file "app/views/notifier/bar.text.haml" do |view|
      assert_match %r(app/views/notifier/bar\.text\.haml), view
      assert_match /\= @greeting/, view
    end

    assert_file "app/views/notifier/bar.html.haml" do |view|
      assert_match %r(app/views/notifier/bar\.html\.haml), view
      assert_match /\= @greeting/, view
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/haml-rails-0.9.0/test/lib/generators/haml/mailer_generator_test.rb
haml-rails-0.9.0 test/lib/generators/haml/mailer_generator_test.rb