Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix tests

Ugh, I transposed expected and actual.
/me hangs head in shame

Add test helper methods to reduce horizontal scrolling.
  • Loading branch information...
commit 5c5f016768e66d9acb622f0d5437631e0b7c5ccc 1 parent 1bc3486
@blowmage authored
View
34 test/rails/action_controller/test_spec_type.rb
@@ -8,26 +8,34 @@ class ApplicationController < ActionController::Base; end
class ModelsController < ApplicationController; end
class TestApplicationControllerSpecType < MiniTest::Unit::TestCase
+ def assert_controller actual
+ assert_equal MiniTest::Rails::ActionController::TestCase, actual
+ end
+
+ def refute_controller actual
+ refute_equal MiniTest::Rails::ActionController::TestCase, actual
+ end
+
def test_spec_type_resolves_for_class_constants
- assert_equal MiniTest::Spec.spec_type(ApplicationController), MiniTest::Rails::ActionController::TestCase
- assert_equal MiniTest::Spec.spec_type(ModelsController), MiniTest::Rails::ActionController::TestCase
+ assert_controller MiniTest::Spec.spec_type(ApplicationController)
+ assert_controller MiniTest::Spec.spec_type(ModelsController)
end
def test_spec_type_resolves_for_matching_strings
- assert_equal MiniTest::Spec.spec_type("WidgetController"), MiniTest::Rails::ActionController::TestCase
- assert_equal MiniTest::Spec.spec_type("WidgetControllerTest"), MiniTest::Rails::ActionController::TestCase
- assert_equal MiniTest::Spec.spec_type("Widget Controller Test"), MiniTest::Rails::ActionController::TestCase
+ assert_controller MiniTest::Spec.spec_type("WidgetController")
+ assert_controller MiniTest::Spec.spec_type("WidgetControllerTest")
+ assert_controller MiniTest::Spec.spec_type("Widget Controller Test")
# And is not case sensitive
- assert_equal MiniTest::Spec.spec_type("widgetcontroller"), MiniTest::Rails::ActionController::TestCase
- assert_equal MiniTest::Spec.spec_type("widgetcontrollertest"), MiniTest::Rails::ActionController::TestCase
- assert_equal MiniTest::Spec.spec_type("widget controller test"), MiniTest::Rails::ActionController::TestCase
+ assert_controller MiniTest::Spec.spec_type("widgetcontroller")
+ assert_controller MiniTest::Spec.spec_type("widgetcontrollertest")
+ assert_controller MiniTest::Spec.spec_type("widget controller test")
end
def test_spec_type_wont_match_non_space_characters
- refute_equal MiniTest::Spec.spec_type("Widget Controller\tTest"), MiniTest::Rails::ActionController::TestCase
- refute_equal MiniTest::Spec.spec_type("Widget Controller\rTest"), MiniTest::Rails::ActionController::TestCase
- refute_equal MiniTest::Spec.spec_type("Widget Controller\nTest"), MiniTest::Rails::ActionController::TestCase
- refute_equal MiniTest::Spec.spec_type("Widget Controller\fTest"), MiniTest::Rails::ActionController::TestCase
- refute_equal MiniTest::Spec.spec_type("Widget ControllerXTest"), MiniTest::Rails::ActionController::TestCase
+ refute_controller MiniTest::Spec.spec_type("Widget Controller\tTest")
+ refute_controller MiniTest::Spec.spec_type("Widget Controller\rTest")
+ refute_controller MiniTest::Spec.spec_type("Widget Controller\nTest")
+ refute_controller MiniTest::Spec.spec_type("Widget Controller\fTest")
+ refute_controller MiniTest::Spec.spec_type("Widget ControllerXTest")
end
end
View
34 test/rails/test_action_dispatch_spec_type.rb
@@ -4,29 +4,37 @@
require "minitest/rails/action_dispatch"
class TestActionDispatchSpecType < MiniTest::Unit::TestCase
+ def assert_dispatch actual
+ assert_equal MiniTest::Rails::ActionDispatch::IntegrationTest, actual
+ end
+
+ def refute_dispatch actual
+ refute_equal MiniTest::Rails::ActionDispatch::IntegrationTest, actual
+ end
+
def test_spec_type_resolves_for_matching_acceptance_strings
- assert_equal MiniTest::Spec.spec_type("WidgetAcceptanceTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
- assert_equal MiniTest::Spec.spec_type("Widget Acceptance Test"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ assert_dispatch MiniTest::Spec.spec_type("WidgetAcceptanceTest")
+ assert_dispatch MiniTest::Spec.spec_type("Widget Acceptance Test")
# And is not case sensitive
- assert_equal MiniTest::Spec.spec_type("widgetacceptancetest"), MiniTest::Rails::ActionDispatch::IntegrationTest
- assert_equal MiniTest::Spec.spec_type("widget acceptance test"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ assert_dispatch MiniTest::Spec.spec_type("widgetacceptancetest")
+ assert_dispatch MiniTest::Spec.spec_type("widget acceptance test")
end
def test_spec_type_wont_match_non_space_characters_acceptance
- refute_equal MiniTest::Spec.spec_type("Widget Acceptance\tTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
- refute_equal MiniTest::Spec.spec_type("Widget Acceptance\rTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\tTest")
+ refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\rTest")
# TODO: Update regex so that new lines don't match.
- refute_equal MiniTest::Spec.spec_type("Widget Acceptance\nTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
- refute_equal MiniTest::Spec.spec_type("Widget Acceptance\fTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
- refute_equal MiniTest::Spec.spec_type("Widget AcceptanceXTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\nTest")
+ refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\fTest")
+ refute_dispatch MiniTest::Spec.spec_type("Widget AcceptanceXTest")
end
def test_spec_type_resolves_for_matching_integration_strings
- assert_equal MiniTest::Spec.spec_type("WidgetIntegrationTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
- assert_equal MiniTest::Spec.spec_type("Widget Integration Test"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ assert_dispatch MiniTest::Spec.spec_type("WidgetIntegrationTest")
+ assert_dispatch MiniTest::Spec.spec_type("Widget Integration Test")
# And is not case sensitive
- assert_equal MiniTest::Spec.spec_type("widgetintegrationtest"), MiniTest::Rails::ActionDispatch::IntegrationTest
- assert_equal MiniTest::Spec.spec_type("widget integration test"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ assert_dispatch MiniTest::Spec.spec_type("widgetintegrationtest")
+ assert_dispatch MiniTest::Spec.spec_type("widget integration test")
end
def test_spec_type_wont_match_non_space_characters_integration
View
34 test/rails/test_action_mailer_spec_type.rb
@@ -9,26 +9,34 @@ class NotificationMailer < ActionMailer::Base; end
class Notifications < ActionMailer::Base; end
class TestActionMailerSpecType < MiniTest::Unit::TestCase
+ def assert_mailer actual
+ assert_equal MiniTest::Rails::ActionMailer::TestCase, actual
+ end
+
+ def refute_mailer actual
+ refute_equal MiniTest::Rails::ActionMailer::TestCase, actual
+ end
+
def test_spec_type_resolves_for_class_constants
- assert_equal MiniTest::Spec.spec_type(NotificationMailer), MiniTest::Rails::ActionMailer::TestCase
- assert_equal MiniTest::Spec.spec_type(Notifications), MiniTest::Rails::ActionMailer::TestCase
+ assert_mailer MiniTest::Spec.spec_type(NotificationMailer)
+ assert_mailer MiniTest::Spec.spec_type(Notifications)
end
def test_spec_type_resolves_for_matching_strings
- assert_equal MiniTest::Spec.spec_type("WidgetMailer"), MiniTest::Rails::ActionMailer::TestCase
- assert_equal MiniTest::Spec.spec_type("WidgetMailerTest"), MiniTest::Rails::ActionMailer::TestCase
- assert_equal MiniTest::Spec.spec_type("Widget Mailer Test"), MiniTest::Rails::ActionMailer::TestCase
+ 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_equal MiniTest::Spec.spec_type("widgetmailer"), MiniTest::Rails::ActionMailer::TestCase
- assert_equal MiniTest::Spec.spec_type("widgetmailertest"), MiniTest::Rails::ActionMailer::TestCase
- assert_equal MiniTest::Spec.spec_type("widget mailer test"), MiniTest::Rails::ActionMailer::TestCase
+ 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_equal MiniTest::Spec.spec_type("Widget Mailer\tTest"), MiniTest::Rails::ActionMailer::TestCase
- refute_equal MiniTest::Spec.spec_type("Widget Mailer\rTest"), MiniTest::Rails::ActionMailer::TestCase
- refute_equal MiniTest::Spec.spec_type("Widget Mailer\nTest"), MiniTest::Rails::ActionMailer::TestCase
- refute_equal MiniTest::Spec.spec_type("Widget Mailer\fTest"), MiniTest::Rails::ActionMailer::TestCase
- refute_equal MiniTest::Spec.spec_type("Widget MailerXTest"), MiniTest::Rails::ActionMailer::TestCase
+ 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
View
42 test/rails/test_action_view_spec_type.rb
@@ -4,31 +4,39 @@
require "minitest/rails/action_view"
class TestActionViewSpecType < MiniTest::Unit::TestCase
+ def assert_view actual
+ assert_equal MiniTest::Rails::ActionView::TestCase, actual
+ end
+
+ def refute_view actual
+ refute_equal MiniTest::Rails::ActionView::TestCase, actual
+ end
+
def test_spec_type_resolves_for_matching_helper_strings
- assert_equal MiniTest::Spec.spec_type("WidgetHelper"), MiniTest::Rails::ActionView::TestCase
- assert_equal MiniTest::Spec.spec_type("WidgetHelperTest"), MiniTest::Rails::ActionView::TestCase
- assert_equal MiniTest::Spec.spec_type("Widget Helper Test"), MiniTest::Rails::ActionView::TestCase
+ assert_view MiniTest::Spec.spec_type("WidgetHelper")
+ assert_view MiniTest::Spec.spec_type("WidgetHelperTest")
+ assert_view MiniTest::Spec.spec_type("Widget Helper Test")
# And is not case sensitive
- assert_equal MiniTest::Spec.spec_type("widgethelper"), MiniTest::Rails::ActionView::TestCase
- assert_equal MiniTest::Spec.spec_type("widgethelpertest"), MiniTest::Rails::ActionView::TestCase
- assert_equal MiniTest::Spec.spec_type("widget helper test"), MiniTest::Rails::ActionView::TestCase
+ assert_view MiniTest::Spec.spec_type("widgethelper")
+ assert_view MiniTest::Spec.spec_type("widgethelpertest")
+ assert_view MiniTest::Spec.spec_type("widget helper test")
end
def test_spec_type_resolves_for_matching_view_strings
- assert_equal MiniTest::Spec.spec_type("WidgetView"), MiniTest::Rails::ActionView::TestCase
- assert_equal MiniTest::Spec.spec_type("WidgetViewTest"), MiniTest::Rails::ActionView::TestCase
- assert_equal MiniTest::Spec.spec_type("Widget View Test"), MiniTest::Rails::ActionView::TestCase
+ assert_view MiniTest::Spec.spec_type("WidgetView")
+ assert_view MiniTest::Spec.spec_type("WidgetViewTest")
+ assert_view MiniTest::Spec.spec_type("Widget View Test")
# And is not case sensitive
- assert_equal MiniTest::Spec.spec_type("widgetview"), MiniTest::Rails::ActionView::TestCase
- assert_equal MiniTest::Spec.spec_type("widgetviewtest"), MiniTest::Rails::ActionView::TestCase
- assert_equal MiniTest::Spec.spec_type("widget view test"), MiniTest::Rails::ActionView::TestCase
+ assert_view MiniTest::Spec.spec_type("widgetview")
+ assert_view MiniTest::Spec.spec_type("widgetviewtest")
+ assert_view MiniTest::Spec.spec_type("widget view test")
end
def test_spec_type_wont_match_non_space_characters
- refute_equal MiniTest::Spec.spec_type("Widget Helper\tTest"), MiniTest::Rails::ActionView::TestCase
- refute_equal MiniTest::Spec.spec_type("Widget Helper\rTest"), MiniTest::Rails::ActionView::TestCase
- refute_equal MiniTest::Spec.spec_type("Widget Helper\nTest"), MiniTest::Rails::ActionView::TestCase
- refute_equal MiniTest::Spec.spec_type("Widget Helper\fTest"), MiniTest::Rails::ActionView::TestCase
- refute_equal MiniTest::Spec.spec_type("Widget HelperXTest"), MiniTest::Rails::ActionView::TestCase
+ refute_view MiniTest::Spec.spec_type("Widget Helper\tTest")
+ refute_view MiniTest::Spec.spec_type("Widget Helper\rTest")
+ refute_view MiniTest::Spec.spec_type("Widget Helper\nTest")
+ refute_view MiniTest::Spec.spec_type("Widget Helper\fTest")
+ refute_view MiniTest::Spec.spec_type("Widget HelperXTest")
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.