forked from rails/rails
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request rails#7749 from blowmage/minitest
Improve support for minitest's spec DSL
- Loading branch information
Showing
16 changed files
with
726 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
require 'abstract_unit' | ||
|
||
class NotificationMailer < ActionMailer::Base; end | ||
class Notifications < ActionMailer::Base; end | ||
|
||
class SpecTypeTest < ActiveSupport::TestCase | ||
def assert_mailer actual | ||
assert_equal ActionMailer::TestCase, actual | ||
end | ||
|
||
def refute_mailer actual | ||
refute_equal ActionMailer::TestCase, actual | ||
end | ||
|
||
def test_spec_type_resolves_for_class_constants | ||
assert_mailer MiniTest::Spec.spec_type(NotificationMailer) | ||
assert_mailer MiniTest::Spec.spec_type(Notifications) | ||
end | ||
|
||
def test_spec_type_resolves_for_matching_strings | ||
assert_mailer MiniTest::Spec.spec_type("WidgetMailer") | ||
assert_mailer MiniTest::Spec.spec_type("WidgetMailerTest") | ||
assert_mailer MiniTest::Spec.spec_type("Widget Mailer Test") | ||
# And is not case sensitive | ||
assert_mailer MiniTest::Spec.spec_type("widgetmailer") | ||
assert_mailer MiniTest::Spec.spec_type("widgetmailertest") | ||
assert_mailer MiniTest::Spec.spec_type("widget mailer test") | ||
end | ||
|
||
def test_spec_type_wont_match_non_space_characters | ||
refute_mailer MiniTest::Spec.spec_type("Widget Mailer\tTest") | ||
refute_mailer MiniTest::Spec.spec_type("Widget Mailer\rTest") | ||
refute_mailer MiniTest::Spec.spec_type("Widget Mailer\nTest") | ||
refute_mailer MiniTest::Spec.spec_type("Widget Mailer\fTest") | ||
refute_mailer MiniTest::Spec.spec_type("Widget MailerXTest") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.