Permalink
Browse files

Match View specs names [closes #70]

  • Loading branch information...
1 parent 38d47d2 commit 1bc3486188bbc8aa2a53fb04913a72fbe6b650ad @sauy7 sauy7 committed with Aug 27, 2012
Showing with 14 additions and 1 deletion.
  1. +3 −0 lib/minitest/rails/action_view.rb
  2. +11 −1 test/rails/test_action_view_spec_type.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
@@ -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

0 comments on commit 1bc3486

Please sign in to comment.