diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..bf43e61 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,22 @@ +name: Linter + +on: + - push + - pull_request + +jobs: + check-changelog: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.0.0 + bundler-cache: true + - name: Bundle install + run: | + gem install bundler + bundle install --jobs 4 --retry 3 --path vendor/bundle + - name: Run Linter + run: bundle exec standardrb diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1df7c2b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,36 +0,0 @@ -language: ruby -sudo: false - -before_install: - - gem update --system - - gem --version - - gem install bundler --no-document - -rvm: - - 2.4.6 - - 2.5.5 - - 2.6.5 - - 2.7.0 - - ruby-head - -gemfile: - - gemfiles/rails_5.gemfile - - gemfiles/rails_51.gemfile - - gemfiles/rails_52.gemfile - - gemfiles/rails_6.gemfile - - gemfiles/rails_head.gemfile - -matrix: - exclude: - - rvm: 2.3.8 - gemfile: gemfiles/rails_6.gemfile - - rvm: 2.4.6 - gemfile: gemfiles/rails_6.gemfile - - rvm: 2.3.8 - gemfile: gemfiles/rails_head.gemfile - - rvm: 2.4.6 - gemfile: gemfiles/rails_head.gemfile - allow_failures: - - rvm: ruby-head - - gemfile: gemfiles/rails_head.gemfile - fast_finish: true diff --git a/Appraisals b/Appraisals index c32c53f..8e87d6e 100644 --- a/Appraisals +++ b/Appraisals @@ -1,19 +1,19 @@ appraise "rails_5_2" do gem "rails", "5.2.3" gem "sqlite3", "~> 1.4" - gem 'net-smtp', require: false + gem "net-smtp", require: false end appraise "rails_6_0" do gem "rails", "6.0.5" gem "sqlite3", "~> 1.4" - gem 'net-smtp', require: false + gem "net-smtp", require: false end appraise "rails_6_1" do gem "rails", "6.1.6" gem "sqlite3", "~> 1.4" - gem 'net-smtp', require: false + gem "net-smtp", require: false end appraise "rails_7_0" do diff --git a/Rakefile b/Rakefile index c8e57b9..09b2952 100644 --- a/Rakefile +++ b/Rakefile @@ -1,35 +1,33 @@ begin - require 'bundler/setup' + require "bundler/setup" rescue LoadError - puts 'You must `gem install bundler` and `bundle install` to run rake tasks' + puts "You must `gem install bundler` and `bundle install` to run rake tasks" end -require 'rdoc/task' +require "rdoc/task" RDoc::Task.new(:rdoc) do |rdoc| - rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'Maildown' - rdoc.options << '--line-numbers' - rdoc.rdoc_files.include('README.md') - rdoc.rdoc_files.include('lib/**/*.rb') + rdoc.rdoc_dir = "rdoc" + rdoc.title = "Maildown" + rdoc.options << "--line-numbers" + rdoc.rdoc_files.include("README.md") + rdoc.rdoc_files.include("lib/**/*.rb") end APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__) -load 'rails/tasks/engine.rake' - +load "rails/tasks/engine.rake" Bundler::GemHelper.install_tasks -require 'rake/testtask' +require "rake/testtask" Rake::TestTask.new(:test) do |t| - t.libs << 'lib' - t.libs << 'test' - t.pattern = 'test/**/*_test.rb' + t.libs << "lib" + t.libs << "test" + t.pattern = "test/**/*_test.rb" t.verbose = false end - task default: :test require "bundler/gem_tasks" diff --git a/lib/maildown.rb b/lib/maildown.rb index e103058..c55fe92 100644 --- a/lib/maildown.rb +++ b/lib/maildown.rb @@ -1,7 +1,7 @@ # Top level module, all module methods are used for configuration module Maildown @allow_indentations = false - @enable_layouts = false + @enable_layouts = false def self.allow_indentation @allow_indentations @@ -16,11 +16,11 @@ def self.rails_6? end end -require 'maildown/markdown_engine' +require "maildown/markdown_engine" ActiveSupport.on_load(:action_mailer) do - require 'maildown/ext/action_mailer' + require "maildown/ext/action_mailer" end ActiveSupport.on_load(:action_view) do - require 'maildown/ext/action_view' + require "maildown/ext/action_view" end -require 'maildown/handlers/markdown' +require "maildown/handlers/markdown" diff --git a/lib/maildown/ext/action_mailer.rb b/lib/maildown/ext/action_mailer.rb index cae3132..781b832 100644 --- a/lib/maildown/ext/action_mailer.rb +++ b/lib/maildown/ext/action_mailer.rb @@ -34,7 +34,7 @@ # This monkeypatch detects when a markdown email is being # used and generates both a markdown and text template class ActionMailer::Base - alias :original_each_template :each_template + alias_method :original_each_template, :each_template def each_template(paths, name, &block) templates = original_each_template(paths, name, &block) @@ -44,8 +44,8 @@ def each_template(paths, name, &block) html_template = templates.first # Cached template is already defined - if html_template.instance_variable_defined?(:"@maildown_text_template") - text_template = html_template.instance_variable_get(:"@maildown_text_template") + if html_template.instance_variable_defined?(:@maildown_text_template) + text_template = html_template.instance_variable_get(:@maildown_text_template) return [html_template, text_template] end @@ -66,8 +66,8 @@ def each_template(paths, name, &block) text_template.formats = formats end - html_template.instance_variable_set(:"@maildown_text_template", text_template) + html_template.instance_variable_set(:@maildown_text_template, text_template) - return [html_template, text_template] + [html_template, text_template] end end diff --git a/lib/maildown/ext/action_view.rb b/lib/maildown/ext/action_view.rb index 375e2ab..5895151 100644 --- a/lib/maildown/ext/action_view.rb +++ b/lib/maildown/ext/action_view.rb @@ -19,17 +19,17 @@ def extract_handler_and_format_and_variant(template) # in addition to `.md+erb` and `.md` module ActionView class OptimizedFileSystemResolver - alias :original_extract_handler_and_format_and_variant :extract_handler_and_format_and_variant + alias_method :original_extract_handler_and_format_and_variant, :extract_handler_and_format_and_variant # Different versions of rails have different # method signatures here, path is always first def extract_handler_and_format_and_variant(*args) - if args.first.end_with?('md.erb') + if args.first.end_with?("md.erb") path = args.shift - path = path.gsub(/\.md\.erb\z/, '.md+erb') + path = path.gsub(/\.md\.erb\z/, ".md+erb") args.unshift(path) end - return original_extract_handler_and_format_and_variant(*args) + original_extract_handler_and_format_and_variant(*args) end end end diff --git a/lib/maildown/handlers/markdown.rb b/lib/maildown/handlers/markdown.rb index bd5a755..5a43e0e 100644 --- a/lib/maildown/handlers/markdown.rb +++ b/lib/maildown/handlers/markdown.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true -require 'action_view' + +require "action_view" module Maildown module Handlers @@ -32,7 +33,7 @@ def self.call(template, source = nil) # Match beginning whitespace but not newline # http://rubular.com/r/uCXQ58OOC8 - source.gsub!(/^[^\S\n]+/, ''.freeze) if Maildown.allow_indentation + source.gsub!(/^[^\S\n]+/, "") if Maildown.allow_indentation if Maildown.rails_6? compiled_source = erb_handler.call(template, source) @@ -55,7 +56,7 @@ def self.call(template, source = nil) # Allows for templates like `contact.md` or `contact.md+erb` to be rendered as # markdown. ActionView::Template.register_template_handler :"md+erb", Maildown::Handlers::Markdown -ActionView::Template.register_template_handler :"md", Maildown::Handlers::Markdown +ActionView::Template.register_template_handler :md, Maildown::Handlers::Markdown # Used in conjunction with ext/action_view.rb monkey patch # to allow for using the ".md.erb" file "extension". diff --git a/lib/maildown/markdown_engine.rb b/lib/maildown/markdown_engine.rb index 7cc5354..73ede80 100644 --- a/lib/maildown/markdown_engine.rb +++ b/lib/maildown/markdown_engine.rb @@ -58,4 +58,4 @@ def self.default_text_block end end -Maildown::MarkdownEngine.autoload(:"Kramdown", "kramdown") +Maildown::MarkdownEngine.autoload(:Kramdown, "kramdown") diff --git a/maildown.gemspec b/maildown.gemspec index 38c567b..8fa7f9b 100644 --- a/maildown.gemspec +++ b/maildown.gemspec @@ -5,17 +5,16 @@ require "maildown/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| - s.name = "maildown" - s.version = Maildown::VERSION - s.authors = ["schneems"] - s.email = ["richard.schneeman@gmail.com"] - s.homepage = "https://www.github.com/schneems/maildown" - s.summary = "Markdown in your mailbox" + s.name = "maildown" + s.version = Maildown::VERSION + s.authors = ["schneems"] + s.email = ["richard.schneeman@gmail.com"] + s.homepage = "https://www.github.com/schneems/maildown" + s.summary = "Markdown in your mailbox" s.description = "Best practice is to send text/plain && text/html markdown works great for both, so why write your templates twices?" - s.license = "MIT" + s.license = "MIT" s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] - s.test_files = Dir["test/**/*"] s.add_dependency "actionmailer", ">= 4.0.0" s.add_dependency "kramdown-parser-gfm" @@ -24,4 +23,5 @@ Gem::Specification.new do |s| s.add_development_dependency "m" s.add_development_dependency "sqlite3" s.add_development_dependency "rake" + s.add_development_dependency "standard" end diff --git a/test/dummy/Rakefile b/test/dummy/Rakefile index 4135d7a..292b11d 100644 --- a/test/dummy/Rakefile +++ b/test/dummy/Rakefile @@ -1,6 +1,6 @@ # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. -require File.expand_path('../config/application', __FILE__) +require File.expand_path("../config/application", __FILE__) Dummy::Application.load_tasks diff --git a/test/dummy/app/controllers/handlers_controller.rb b/test/dummy/app/controllers/handlers_controller.rb index 84bc1cd..4cc7da4 100644 --- a/test/dummy/app/controllers/handlers_controller.rb +++ b/test/dummy/app/controllers/handlers_controller.rb @@ -1,5 +1,4 @@ class HandlersController < ApplicationController - def show render params[:id] end diff --git a/test/dummy/app/mailers/application_mailer.rb b/test/dummy/app/mailers/application_mailer.rb index 5af6723..bcf5760 100644 --- a/test/dummy/app/mailers/application_mailer.rb +++ b/test/dummy/app/mailers/application_mailer.rb @@ -1,4 +1,3 @@ class ApplicationMailer < ActionMailer::Base - default from: 'from@example.com' + default from: "from@example.com" end - diff --git a/test/dummy/app/mailers/user_no_layout_mailer.rb b/test/dummy/app/mailers/user_no_layout_mailer.rb index 7e45cfb..7ea8cfb 100644 --- a/test/dummy/app/mailers/user_no_layout_mailer.rb +++ b/test/dummy/app/mailers/user_no_layout_mailer.rb @@ -3,33 +3,33 @@ class UserNoLayoutMailer < ApplicationMailer def welcome mail( - to: "foo@example.com", + to: "foo@example.com", reply_to: "noreply@schneems.com", - subject: "hello world" + subject: "hello world" ) end def leading_whitespace mail( - to: "foo@example.com", + to: "foo@example.com", reply_to: "noreply@schneems.com", - subject: "hello world" + subject: "hello world" ) end def leading_whitespace_again mail( - to: "foo@example.com", + to: "foo@example.com", reply_to: "noreply@schneems.com", - subject: "hello world" + subject: "hello world" ) end def contact mail( - to: "foo@example.com", + to: "foo@example.com", reply_to: "noreply@schneems.com", - subject: "hello world" + subject: "hello world" ) end end diff --git a/test/dummy/app/mailers/user_with_layout_mailer.rb b/test/dummy/app/mailers/user_with_layout_mailer.rb index 8ef3499..2ec9c8b 100644 --- a/test/dummy/app/mailers/user_with_layout_mailer.rb +++ b/test/dummy/app/mailers/user_with_layout_mailer.rb @@ -3,9 +3,9 @@ class UserWithLayoutMailer < ApplicationMailer def welcome mail( - to: "foo@example.com", + to: "foo@example.com", reply_to: "noreply@schneems.com", - subject: "hello world" + subject: "hello world" ) end end diff --git a/test/dummy/bin/bundle b/test/dummy/bin/bundle index 66e9889..fe18745 100755 --- a/test/dummy/bin/bundle +++ b/test/dummy/bin/bundle @@ -1,3 +1,3 @@ #!/usr/bin/env ruby -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -load Gem.bin_path('bundler', 'bundle') +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__) +load Gem.bin_path("bundler", "bundle") diff --git a/test/dummy/bin/rails b/test/dummy/bin/rails index 728cd85..8b24567 100755 --- a/test/dummy/bin/rails +++ b/test/dummy/bin/rails @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -APP_PATH = File.expand_path('../../config/application', __FILE__) -require_relative '../config/boot' -require 'rails/commands' +APP_PATH = File.expand_path("../../config/application", __FILE__) +require_relative "../config/boot" +require "rails/commands" diff --git a/test/dummy/bin/rake b/test/dummy/bin/rake index 1724048..4fbf10b 100755 --- a/test/dummy/bin/rake +++ b/test/dummy/bin/rake @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -require_relative '../config/boot' -require 'rake' +require_relative "../config/boot" +require "rake" Rake.application.run diff --git a/test/dummy/config.ru b/test/dummy/config.ru index 5bc2a61..193e5fe 100644 --- a/test/dummy/config.ru +++ b/test/dummy/config.ru @@ -1,4 +1,4 @@ # This file is used by Rack-based servers to start the application. -require ::File.expand_path('../config/environment', __FILE__) +require ::File.expand_path("../config/environment", __FILE__) run Rails.application diff --git a/test/dummy/config/application.rb b/test/dummy/config/application.rb index b558ab0..5efde28 100644 --- a/test/dummy/config/application.rb +++ b/test/dummy/config/application.rb @@ -1,6 +1,6 @@ -require File.expand_path('../boot', __FILE__) +require File.expand_path("../boot", __FILE__) -require 'rails/all' +require "rails/all" Bundler.require(*Rails.groups) require "maildown" @@ -20,4 +20,3 @@ class Application < Rails::Application # config.i18n.default_locale = :de end end - diff --git a/test/dummy/config/boot.rb b/test/dummy/config/boot.rb index 6266cfc..a66e6b4 100644 --- a/test/dummy/config/boot.rb +++ b/test/dummy/config/boot.rb @@ -1,5 +1,5 @@ # Set up gems listed in the Gemfile. -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__) +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../../Gemfile", __FILE__) -require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) -$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__) +require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"]) +$LOAD_PATH.unshift File.expand_path("../../../../lib", __FILE__) diff --git a/test/dummy/config/environment.rb b/test/dummy/config/environment.rb index 10e0cad..1e9194e 100644 --- a/test/dummy/config/environment.rb +++ b/test/dummy/config/environment.rb @@ -1,5 +1,5 @@ # Load the Rails application. -require File.expand_path('../application', __FILE__) +require File.expand_path("../application", __FILE__) # Initialize the Rails application. Dummy::Application.initialize! diff --git a/test/dummy/config/environments/development.rb b/test/dummy/config/environments/development.rb index 7201ec4..581fe39 100644 --- a/test/dummy/config/environments/development.rb +++ b/test/dummy/config/environments/development.rb @@ -10,7 +10,7 @@ config.eager_load = false # Show full error reports and disable caching. - config.consider_all_requests_local = true + config.consider_all_requests_local = true config.action_controller.perform_caching = false # Don't care if the mailer can't send. diff --git a/test/dummy/config/environments/production.rb b/test/dummy/config/environments/production.rb index b690b1c..9edbc79 100644 --- a/test/dummy/config/environments/production.rb +++ b/test/dummy/config/environments/production.rb @@ -11,7 +11,7 @@ config.eager_load = true # Full error reports are disabled and caching is turned on. - config.consider_all_requests_local = false + config.consider_all_requests_local = false config.action_controller.perform_caching = true # Enable Rack::Cache to put a simple HTTP cache in front of your application @@ -33,7 +33,7 @@ config.assets.digest = true # Version of your assets, change this if you want to expire all your assets. - config.assets.version = '1.0' + config.assets.version = "1.0" # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache diff --git a/test/dummy/config/environments/test.rb b/test/dummy/config/environments/test.rb index f907604..103c530 100644 --- a/test/dummy/config/environments/test.rb +++ b/test/dummy/config/environments/test.rb @@ -13,11 +13,11 @@ config.eager_load = false # Configure static asset server for tests with Cache-Control for performance. - config.serve_static_assets = true - config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' } + config.serve_static_assets = true + config.public_file_server.headers = {"Cache-Control" => "public, max-age=3600"} # Show full error reports and disable caching. - config.consider_all_requests_local = true + config.consider_all_requests_local = true config.action_controller.perform_caching = false # Raise exceptions instead of rendering exception templates. diff --git a/test/dummy/config/initializers/secret_token.rb b/test/dummy/config/initializers/secret_token.rb index e68ab45..32202ce 100644 --- a/test/dummy/config/initializers/secret_token.rb +++ b/test/dummy/config/initializers/secret_token.rb @@ -9,4 +9,4 @@ # Make sure your secret_key_base is kept private # if you're sharing your code publicly. -Dummy::Application.config.secret_key_base = '302e49aee155f203d3391d98cae5401e28a931af85774ac884df3531396afb1eef9c35111a1e290a3b7a7ee274594c3dfc5c1cf21ab2557d1c870b2c447e968f' +Dummy::Application.config.secret_key_base = "302e49aee155f203d3391d98cae5401e28a931af85774ac884df3531396afb1eef9c35111a1e290a3b7a7ee274594c3dfc5c1cf21ab2557d1c870b2c447e968f" diff --git a/test/dummy/config/initializers/session_store.rb b/test/dummy/config/initializers/session_store.rb index 155f7b0..e4995ac 100644 --- a/test/dummy/config/initializers/session_store.rb +++ b/test/dummy/config/initializers/session_store.rb @@ -1,3 +1,3 @@ # Be sure to restart your server when you modify this file. -Dummy::Application.config.session_store :cookie_store, key: '_dummy_session' +Dummy::Application.config.session_store :cookie_store, key: "_dummy_session" diff --git a/test/dummy/test/mailers/previews/user_no_layout_mailer_preview.rb b/test/dummy/test/mailers/previews/user_no_layout_mailer_preview.rb index 31eafb9..05285ca 100644 --- a/test/dummy/test/mailers/previews/user_no_layout_mailer_preview.rb +++ b/test/dummy/test/mailers/previews/user_no_layout_mailer_preview.rb @@ -1,4 +1,3 @@ # Preview all emails at http://localhost:3000/rails/mailers/user_no_layout_mailer class UserNoLayoutMailerPreview < ActionMailer::Preview - end diff --git a/test/dummy/test/mailers/previews/user_with_layout_mailer_preview.rb b/test/dummy/test/mailers/previews/user_with_layout_mailer_preview.rb index f8054dc..06da897 100644 --- a/test/dummy/test/mailers/previews/user_with_layout_mailer_preview.rb +++ b/test/dummy/test/mailers/previews/user_with_layout_mailer_preview.rb @@ -1,4 +1,3 @@ # Preview all emails at http://localhost:3000/rails/mailers/user_with_layout_mailer class UserWithLayoutMailerPreview < ActionMailer::Preview - end diff --git a/test/dummy/test/mailers/user_no_layout_mailer_test.rb b/test/dummy/test/mailers/user_no_layout_mailer_test.rb index 5e51d48..d61360b 100644 --- a/test/dummy/test/mailers/user_no_layout_mailer_test.rb +++ b/test/dummy/test/mailers/user_no_layout_mailer_test.rb @@ -1,4 +1,4 @@ -require 'test_helper' +require "test_helper" class UserNoLayoutMailerTest < ActionMailer::TestCase # test "the truth" do diff --git a/test/dummy/test/mailers/user_with_layout_mailer_test.rb b/test/dummy/test/mailers/user_with_layout_mailer_test.rb index 57fd46b..bd6708e 100644 --- a/test/dummy/test/mailers/user_with_layout_mailer_test.rb +++ b/test/dummy/test/mailers/user_with_layout_mailer_test.rb @@ -1,4 +1,4 @@ -require 'test_helper' +require "test_helper" class UserWithLayoutMailerTest < ActionMailer::TestCase # test "the truth" do diff --git a/test/integration/double_compile_test.rb b/test/integration/double_compile_test.rb index 4c4bf02..3fc2821 100644 --- a/test/integration/double_compile_test.rb +++ b/test/integration/double_compile_test.rb @@ -1,26 +1,25 @@ -require 'test_helper' +require "test_helper" class DoubleCompileTest < ActionMailer::TestCase - def test_rendering_the_same_layout_twice_works email = UserNoLayoutMailer.welcome.deliver_now assert !ActionMailer::Base.deliveries.empty? # Test the body of the sent email contains what we expect it to body_contents = /

Welcome!<\/h2>/ - assert_match body_contents, email.html_part.body.to_s + assert_match body_contents, email.html_part.body.to_s body_contents = /## Welcome!/ - assert_match body_contents, email.text_part.body.to_s + assert_match body_contents, email.text_part.body.to_s email = UserNoLayoutMailer.welcome.deliver_now assert !ActionMailer::Base.deliveries.empty? # Test the body of the sent email contains what we expect it to body_contents = /

Welcome!<\/h2>/ - assert_match body_contents, email.html_part.body.to_s + assert_match body_contents, email.html_part.body.to_s body_contents = /## Welcome!/ - assert_match body_contents, email.text_part.body.to_s + assert_match body_contents, email.text_part.body.to_s end -end \ No newline at end of file +end diff --git a/test/integration/layouts_test.rb b/test/integration/layouts_test.rb index 07458c2..4038d67 100644 --- a/test/integration/layouts_test.rb +++ b/test/integration/layouts_test.rb @@ -1,19 +1,18 @@ -require 'test_helper' +require "test_helper" class LayoutsTest < ActionMailer::TestCase - def test_no_layout email = UserNoLayoutMailer.welcome.deliver_now assert !ActionMailer::Base.deliveries.empty? # Test the body of the sent email contains what we expect it to assert_equal ["foo@example.com"], email.to - assert_equal "hello world", email.subject + assert_equal "hello world", email.subject body_contents = /

Welcome!<\/h2>/ - assert_match body_contents, email.html_part.body.to_s + assert_match body_contents, email.html_part.body.to_s body_contents = /## Welcome!/ - assert_match body_contents, email.text_part.body.to_s + assert_match body_contents, email.text_part.body.to_s end def test_layout_renders_fine @@ -21,12 +20,12 @@ def test_layout_renders_fine assert !ActionMailer::Base.deliveries.empty? # Test the body of the sent email contains what we expect it to assert_equal ["foo@example.com"], email.to - assert_equal "hello world", email.subject + assert_equal "hello world", email.subject body_contents = /HTML

Welcome!<\/h2>/ - assert_match body_contents, email.html_part.body.to_s + assert_match body_contents, email.html_part.body.to_s body_contents = /TEXT## Welcome!/ - assert_match body_contents, email.text_part.body.to_s + assert_match body_contents, email.text_part.body.to_s end end diff --git a/test/integration/strip_leading_whitespace_test.rb b/test/integration/strip_leading_whitespace_test.rb index f5c8791..9f3f878 100644 --- a/test/integration/strip_leading_whitespace_test.rb +++ b/test/integration/strip_leading_whitespace_test.rb @@ -1,4 +1,4 @@ -require 'test_helper' +require "test_helper" class TemplateHandlerTest < ActionDispatch::IntegrationTest def test_strip_whitespace_templates @@ -12,7 +12,7 @@ def test_strip_whitespace_templates assert_equal "## Leading\n", email.text_part.body.to_s assert_equal "text/html", email.html_part.mime_type - assert_equal %Q{

Leading

\n}, email.html_part.body.to_s + assert_equal %(

Leading

\n), email.html_part.body.to_s ensure Maildown.allow_indentation = false end diff --git a/test/integration/template_handler_test.rb b/test/integration/template_handler_test.rb index 62b6c4d..7f48064 100644 --- a/test/integration/template_handler_test.rb +++ b/test/integration/template_handler_test.rb @@ -1,4 +1,4 @@ -require 'test_helper' +require "test_helper" class TemplateHandlerTest < ActionDispatch::IntegrationTest test ".md template handler" do diff --git a/test/test_helper.rb b/test/test_helper.rb index fdcad47..9cff5c3 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,7 +1,7 @@ # Configure Rails Environment ENV["RAILS_ENV"] = "test" -require File.expand_path("../dummy/config/environment.rb", __FILE__) +require File.expand_path("../dummy/config/environment.rb", __FILE__) require "rails/test_help" require "kramdown-parser-gfm" diff --git a/test/unit/ext_action_mailer_test.rb b/test/unit/ext_action_mailer_test.rb index 4dc1402..2e146d8 100644 --- a/test/unit/ext_action_mailer_test.rb +++ b/test/unit/ext_action_mailer_test.rb @@ -1,10 +1,9 @@ -require 'test_helper' +require "test_helper" class ExtActionMailerTest < ActiveSupport::TestCase - test "monkeypatch location" do monkeypatch = ActionMailer::Base.instance_method(:each_template) - path = monkeypatch.source_location.first + path = monkeypatch.source_location.first assert_match "maildown/ext/action_mailer.rb", path end end diff --git a/test/unit/markdown_engine_test.rb b/test/unit/markdown_engine_test.rb index 6f52d11..3db4e27 100644 --- a/test/unit/markdown_engine_test.rb +++ b/test/unit/markdown_engine_test.rb @@ -1,7 +1,6 @@ -require 'test_helper' +require "test_helper" class MarkdownEngineTest < ActiveSupport::TestCase - def setup @default_setup = Maildown::MarkdownEngine.html_block end