From c0a24555f9e2749fb94efe1967cb9943db0b6a7e Mon Sep 17 00:00:00 2001 From: Mike Moore Date: Mon, 24 Sep 2012 15:37:45 -0600 Subject: Support helper tests using spec DSL Improve how helper tests to resolve the helper class from the test name. Add tests for helper tests using the minitest spec DSL. --- actionpack/test/template/test_case_test.rb | 2 +- actionpack/test/template/test_test.rb | 56 ++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) (limited to 'actionpack/test') diff --git a/actionpack/test/template/test_case_test.rb b/actionpack/test/template/test_case_test.rb index 387aafebd4..5265ae6b3a 100644 --- a/actionpack/test/template/test_case_test.rb +++ b/actionpack/test/template/test_case_test.rb @@ -64,7 +64,7 @@ module ActionView assert_equal 'Howdy!', from_another_helper end - test "determine_default_helper_class returns nil if name.sub(/Test$/, '').constantize resolves to a class" do + test "determine_default_helper_class returns nil if the test name constant resolves to a class" do assert_nil self.class.determine_default_helper_class("String") end diff --git a/actionpack/test/template/test_test.rb b/actionpack/test/template/test_test.rb index 108a674d95..e843a1deb4 100644 --- a/actionpack/test/template/test_test.rb +++ b/actionpack/test/template/test_test.rb @@ -78,3 +78,59 @@ class CrazyStringHelperTest < ActionView::TestCase assert_equal PeopleHelper, self.class.helper_class end end + +describe PeopleHelper do + it "resolves the right helper_class" do + assert_equal PeopleHelper, self.class.helper_class + end +end + +describe PeopleHelper, :helper_class do + it "resolves the right helper_class" do + assert_equal PeopleHelper, self.class.helper_class + end +end + +describe PeopleHelper do + describe "even while nested" do + it "resolves the right helper_class" do + assert_equal PeopleHelper, self.class.helper_class + end + end +end + +describe PeopleHelper, :helper_class do + describe "even while nested" do + it "resolves the right helper_class" do + assert_equal PeopleHelper, self.class.helper_class + end + end +end + +describe "PeopleHelper" do + it "resolves the right helper_class" do + assert_equal PeopleHelper, self.class.helper_class + end +end + +describe "PeopleHelperTest" do + it "resolves the right helper_class" do + assert_equal PeopleHelper, self.class.helper_class + end +end + +describe "PeopleHelper" do + describe "even while nested" do + it "resolves the right helper_class" do + assert_equal PeopleHelper, self.class.helper_class + end + end +end + +describe "PeopleHelperTest" do + describe "even while nested" do + it "resolves the right helper_class" do + assert_equal PeopleHelper, self.class.helper_class + end + end +end -- cgit v1.2.3