Commit Graph

45 Commits

Author SHA1 Message Date
Ryuta Kamizono
c81af6ae72 Enable Layout/EmptyLinesAroundAccessModifier cop
We sometimes say "✂️ newline after `private`" in a code review (e.g.
https://github.com/rails/rails/pull/18546#discussion_r23188776,
https://github.com/rails/rails/pull/34832#discussion_r244847195).

Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style
`EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059).

That cop and enforced style will reduce the our code review cost.
2019-06-13 12:00:45 +09:00
Kir Shatrov
82df8c2ca5 Use frozen string literal in actionmailer/ 2017-07-23 18:17:19 +03:00
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
2017-07-02 02:15:17 +09:30
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Akira Matsuda
b70fc698e1 Reduce string objects by using \ instead of + or << for concatenating strings
(I personally prefer writing one string in one line no matter how long it is, though)
2017-01-12 17:45:37 +09:00
Akira Matsuda
5473e390d3 self. is not needed when calling its own instance method
Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
2017-01-05 19:58:52 +09:00
Akira Matsuda
8c7e82e8e0 Privatize unneededly protected methods in Action Mailer 2016-12-24 21:01:07 +09:00
Rafael Mendonça França
0510208dd1
Add load hooks to all tests classes
Usually users extends tests classes doing something like:

    ActionView::TestCase.include MyCustomTestHelpers

This is bad because it will load the ActionView::TestCase right aways
and this will load ActionController::Base making its on_load hooks to
execute early than it should.

One way to fix this is using the on_load hooks of the components like:

    ActiveSupport.on_load(:action_view) do
      ActionView::TestCase.include MyCustomTestHelpers
    end

The problem with this approach is that the test extension will be only
load when ActionView::Base is loaded and this may happen too late in the
test.

To fix this we are adding hooks to people extend the test classes that
will be loaded exactly when the test classes are needed.
2016-08-25 04:22:48 -03:00
Xavier Noria
80e66cc4d9 normalizes indentation and whitespace across the project 2016-08-06 20:16:27 +02:00
Xavier Noria
c3e7abddfb applies new string literal convention in actionmailer/lib
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 19:01:31 +02:00
arktisklada
9d63111499
Clear ActionMailer deliveries on setup and teardown
Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
2016-04-25 22:41:18 -05:00
Edouard CHIN
106ac1016f Small typo on a method name:
- clear_test_deliviers -> clear_test_deliveries
2016-04-15 13:27:09 -04:00
Yves Senn
f41b90fee3 fix class name typo. 2016-02-16 11:57:06 +01:00
Yves Senn
9d37874732 reset ActionMailer::Base.deliveries in ActionDispatch::IntegrationTest.
Whenever you are sending emails in integration tests using the `:test`
delivery method you need to make sure that
`ActionMailer::Base.deliveries` is reset after every test. This piece of
boilerplate code is present in all my applications that send
emails. Let's have `ActionDispatch::IntegrationTest` reset the
deliveries automatically.
2016-02-16 11:20:59 +01:00
Gaurav Sharma
64e316edd3 action mailer test cases protected method can be # :nodoc: 2015-10-04 13:30:00 +05:30
Rafael Mendonça França
0bd1a4e05c Only include the needed assertions 2014-10-07 20:01:40 -03:00
schneems
e6b0b760cc fix tests on action_mailer
Include appropriate helpers and use `assert_dom_equal` where applicable
2014-10-07 17:40:59 -05:00
Lucas Mazza
04db4c2868 Add set_delivery_method and restore_delivery_method to ActionMailer::TestCase.
This way these methods are available outside the ActionMailer test suite, but
they are still duplicated inside `test/abstract_unit` for test cases that don't
inherit from the `ActionMailer::TestCase` class.
2014-08-19 23:26:45 -03:00
Rafael Mendonça França
126a15e0fe Include the selector assertions on the test case
We don't need to require users to include this module on
ActionMailer::TestCase
2014-07-15 13:40:18 -03:00
Timm
ff1b7e7535 Restore delivery method on teardowns. 2014-06-16 21:04:26 +02:00
Zuhao Wan
c4f4123ef4 Restore test deliveries properly in ActionMailer.
`ActionMailer::Base.delivery_method` and
`ActionMailer::Base.perform_deliveries` have leaked states.

"delivery method can be customized per instance" and "delivery method
can be customized in subclasses not changing the parent" in
delivery_methods_test.rb will fail if test_helper_test.rb (in which
TestHelperMailerTest is inherited from ActionMailer::TestCase) runs
before it.
2014-06-07 00:11:24 +08:00
Rafael Mendonça França
eb4930e3c7 Inherit from MiniTest::Unit::TestCase instead of MiniTest::Spec 2012-12-31 13:57:23 -03:00
Andy Lindeman
299e05706e Also includes ConstantLookup dependency for controller and mailer tests 2012-09-26 23:21:26 -04:00
Mike Moore
58434e05fe Support mailer tests using spec DSL
Improve how mailer tests to resolve mailers from the test name.
Add tests for mailer tests using the minitest spec DSL.
2012-09-24 14:46:58 -06:00
Mike Moore
0ce383db58 Register mailer tests for minitest's spec DSL 2012-09-24 14:31:05 -06:00
Xavier Noria
5e1b92044c load active_support/core_ext/class/attribute in active_support/rails 2012-08-02 21:59:23 +02:00
Aaron Patterson
5d09d395de test cases should inherit from AS::TestCase 2012-01-05 17:05:43 -08:00
Jeremy Kemper
b757663af7 Using InstanceMethods in a Concern is deprecated 2011-11-30 10:06:07 -07:00
Alexey Vakhov
0defbc6bfe normalize arg for ActionMailer::TestCase tests method 2011-10-03 14:27:41 +04:00
Josh Kalderimis
d7db6a8873 class inheritable attributes is used no more! all internal use of class inheritable has been changed to class_attribute. class inheritable attributes has been deprecated.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-20 19:40:29 +01:00
Santiago Pastorino
e1d4e78b15 Removes unused vars
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-24 01:19:44 +02:00
David Chelimsky
d588bbd431 Move ActionMailer::TC to AV::TC::Behavior
[#4843 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-12 15:34:31 +02:00
Mikel Lindsaar
dbcf01e631 Removing quoting.rb, upgrade to 2.1.3.6, changing all utf-8 references to UTF-8, updating tests where incorrect encoding 2010-04-11 18:04:55 +10:00
José Valim and Mikel Lindsaar
258ca14800 Delegated ActionMailer::Base.deliveries to Mail.deliveries, added callback support in Mail to call ActionMailer on delivery, moved deliver to deprecated API in preparation for new API 2010-01-24 11:15:42 +11:00
José Valim
fef5afa962 Get rid of RAILS_ROOT deprecation on AM::TestCase. 2010-01-19 16:13:27 +01:00
Joshua Peek
2601a16ede Autoload AS test case 2010-01-04 16:22:46 -06:00
Mikel Lindsaar
a2880827b4 Adding :transfer_encoding -> :content_transfer_encoding as part of TmailCompat 2009-12-31 19:37:37 +11:00
José Valim
616ebb8f6a Remove unused code paths and require mail only when it's needed. 2009-12-28 11:21:36 +01:00
Mikel Lindsaar
539d9b355f More updates... 45 errors left to get it working with Mail gem 2009-11-20 14:10:57 +11:00
Mikel Lindsaar
15d7cac282 Starting again on actionmailer integration with mail 2009-11-12 16:08:50 +11:00
Joshua Peek
e201fc750b use autoload instead of explicit requires for ActionMailer 2008-11-23 12:27:25 -06:00
Jeremy Kemper
139b92495f * Continue evolution toward ActiveSupport::TestCase and friends. #10679 [Josh Peek]
* TestCase: introduce declared setup and teardown callbacks. Pass a list of methods and an optional block to call before setup or after teardown. Setup callbacks are run in the order declared; teardown callbacks are run in reverse.  [Jeremy Kemper]


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8570 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-05 13:34:15 +00:00
David Heinemeier Hansson
6a6367d7d2 Fixed that you don't have to call super in ActionMailer::TestCase#setup (closes #10406) [jamesgolick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8536 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-03 00:40:28 +00:00
Michael Koziarski
cf1217a742 mailer_class is a class method not an instance method. [josh] Closes #10041
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8173 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-11-21 01:08:06 +00:00
Michael Koziarski
2cc0cac3ef Introduce TestCase subclasses for testing rails applications allowing tests to be DRY'd up a bit and to provide a path toward tidying up our monkeypatching of test/unit.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8022 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-26 02:21:21 +00:00