aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/template_test.rb
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2019-02-25 14:43:30 -0800
committerRafael França <rafaelmfranca@gmail.com>2019-02-25 17:43:30 -0500
commitdcb13470991539ab581e02670738900c39976ff4 (patch)
tree4fdbfa0b79aa04f0bbee7c7ca2e0b81bc86feb02 /actionview/test/template/template_test.rb
parent56b030605b4d968077a4ddb96b4ab619e75fb999 (diff)
downloadrails-dcb13470991539ab581e02670738900c39976ff4.tar.gz
rails-dcb13470991539ab581e02670738900c39976ff4.tar.bz2
rails-dcb13470991539ab581e02670738900c39976ff4.zip
Improve Template#inspect output (#35407)
* Don't call inspect from identifier_method_name * Add locals Template#inspect Handler, formats, and variant are usually obvious from looking at the identifier. However it's not uncommon to have different locals for the same template so we should make that obvious in inspect. * Add tests for short_identifier and inspect [John Hawthorn + Rafael Mendonça França]
Diffstat (limited to 'actionview/test/template/template_test.rb')
-rw-r--r--actionview/test/template/template_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/actionview/test/template/template_test.rb b/actionview/test/template/template_test.rb
index 36caef28c2..c74305fb42 100644
--- a/actionview/test/template/template_test.rb
+++ b/actionview/test/template/template_test.rb
@@ -215,4 +215,14 @@ class TestERBTemplate < ActiveSupport::TestCase
ensure
silence_warnings { Encoding.default_external = old }
end
+
+ def test_short_identifier
+ @template = new_template("hello")
+ assert_equal "hello template", @template.short_identifier
+ end
+
+ def test_template_inspect
+ @template = new_template("hello")
+ assert_equal "#<ActionView::Template hello template locals=[]>", @template.inspect
+ end
end