aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-09-29 20:00:10 -0700
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-09-30 00:18:57 -0300
commit7d17cd2cbfc086f5aa9dd636e1207eb130150428 (patch)
tree5fa391252294de8ab1eecdbe18f3afa1a9d813e0 /actionpack/test
parentc2a7084a2df375e2a608767c6079a8d82a783620 (diff)
downloadrails-7d17cd2cbfc086f5aa9dd636e1207eb130150428.tar.gz
rails-7d17cd2cbfc086f5aa9dd636e1207eb130150428.tar.bz2
rails-7d17cd2cbfc086f5aa9dd636e1207eb130150428.zip
Merge pull request #7659 from HugoLnx/template_error_no_matches_rebased
REBASED: fixing assert_template bug when template matches expected, but not ends with Conflicts: actionpack/CHANGELOG.md actionpack/lib/action_controller/test_case.rb
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/action_pack_assertions_test.rb22
-rw-r--r--actionpack/test/fixtures/test/hello/hello.erb1
2 files changed, 23 insertions, 0 deletions
diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb
index 5252e43c25..81cf096952 100644
--- a/actionpack/test/controller/action_pack_assertions_test.rb
+++ b/actionpack/test/controller/action_pack_assertions_test.rb
@@ -7,6 +7,7 @@ class ActionPackAssertionsController < ActionController::Base
def nothing() head :ok end
def hello_world() render :template => "test/hello_world"; end
+ def hello_repeating_in_path() render :template => "test/hello/hello"; end
def hello_xml_world() render :template => "test/hello_xml_world"; end
@@ -469,6 +470,20 @@ class AssertTemplateTest < ActionController::TestCase
end
end
+ def test_fails_with_incorrect_string_that_matches
+ get :hello_world
+ assert_raise(ActiveSupport::TestCase::Assertion) do
+ assert_template 'est/he'
+ end
+ end
+
+ def test_fails_with_repeated_name_in_path
+ get :hello_repeating_in_path
+ assert_raise(ActiveSupport::TestCase::Assertion) do
+ assert_template 'test/hello'
+ end
+ end
+
def test_fails_with_incorrect_symbol
get :hello_world
assert_raise(ActiveSupport::TestCase::Assertion) do
@@ -476,6 +491,13 @@ class AssertTemplateTest < ActionController::TestCase
end
end
+ def test_fails_with_incorrect_symbol_that_matches
+ get :hello_world
+ assert_raise(ActiveSupport::TestCase::Assertion) do
+ assert_template :"est/he"
+ end
+ end
+
def test_fails_with_wrong_layout
get :render_with_layout
assert_raise(ActiveSupport::TestCase::Assertion) do
diff --git a/actionpack/test/fixtures/test/hello/hello.erb b/actionpack/test/fixtures/test/hello/hello.erb
new file mode 100644
index 0000000000..6769dd60bd
--- /dev/null
+++ b/actionpack/test/fixtures/test/hello/hello.erb
@@ -0,0 +1 @@
+Hello world! \ No newline at end of file