test/lib/generators/slim/mailer_generator_test.rb in slim-rails-3.2.0 vs test/lib/generators/slim/mailer_generator_test.rb in slim-rails-3.3.0
- old
+ new
@@ -1,9 +1,11 @@
require 'test_helper'
require 'lib/generators/slim/testing_helper'
class Slim::Generators::MailerGeneratorTest < Rails::Generators::TestCase
+ include SlimLintHelpers
+
destination File.join(Rails.root)
tests Rails::Generators::MailerGenerator
arguments %w(notifier foo bar --template-engine slim)
setup :prepare_destination
@@ -15,16 +17,16 @@
rails_version = ::Rails.version.to_s
if rails_version >= '5.0'
assert_file "app/views/notifier_mailer/foo.html.slim" do |view|
assert_match %r(app/views/notifier_mailer/foo\.html\.slim), view
- assert_match(/\= @greeting/, view)
+ assert_match(/\#\{@greeting/, view)
end
assert_file "app/views/notifier_mailer/bar.html.slim" do |view|
assert_match %r(app/views/notifier_mailer/bar\.html\.slim), view
- assert_match(/\= @greeting/, view)
+ assert_match(/\#\{@greeting/, view)
end
assert_file "app/views/notifier_mailer/foo.text.slim" do |view|
assert_match %r(app/views/notifier_mailer/foo\.text\.slim), view
assert_match(/@greeting/, view)
@@ -44,16 +46,16 @@
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)
+ 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)
+ assert_match(/\#\{@greeting/, view)
end
end
assert_file "app/views/notifier/foo.text.slim" do |view|
@@ -64,7 +66,13 @@
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
+
+ test "should generate SlimLint valid templates" do
+ run_generator
+ templates = Dir[File.join(Rails.root, 'app', 'views', '**', '*.slim')]
+ assert_empty lint(templates)
end
end