Sha256: 4c34d00fc1f05525f1985096b7b9e8dd99c60fe2bbf686bcdb31e24c95fa6fcc

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

require 'test_helper'
require 'lib/generators/slim/testing_helper'

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

  setup :prepare_destination
  setup :copy_routes

  test "should invoke template engine" do
    run_generator

    if ::Rails.version.to_s >= '4.2'

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

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

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

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

    end

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slim-rails-3.1.0 test/lib/generators/slim/mailer_generator_test.rb