Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Match View specs names [closes #70]

  • Loading branch information...
commit 1bc3486188bbc8aa2a53fb04913a72fbe6b650ad 1 parent 38d47d2
@sauy7 sauy7 authored committed
View
3  lib/minitest/rails/action_view.rb
@@ -10,6 +10,9 @@ class TestCase < MiniTest::Rails::ActiveSupport::TestCase
# Register by name, because Helpers are just modules
register_spec_type(/Helper( ?Test)?\z/i, self)
+ # View specs
+ register_spec_type(/View( ?Test)?\z/i, self)
+
include ::ActionView::TestCase::Behavior
end
end
View
12 test/rails/test_action_view_spec_type.rb
@@ -4,7 +4,7 @@
require "minitest/rails/action_view"
class TestActionViewSpecType < MiniTest::Unit::TestCase
- def test_spec_type_resolves_for_matching_strings
+ 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
@@ -14,6 +14,16 @@ def test_spec_type_resolves_for_matching_strings
assert_equal MiniTest::Spec.spec_type("widget helper test"), MiniTest::Rails::ActionView::TestCase
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
+ # 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
+ 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
Please sign in to comment.
Something went wrong with that request. Please try again.