aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template
diff options
context:
space:
mode:
Diffstat (limited to 'actionview/test/template')
-rw-r--r--actionview/test/template/digestor_test.rb2
-rw-r--r--actionview/test/template/html_test.rb6
-rw-r--r--actionview/test/template/lookup_context_test.rb2
-rw-r--r--actionview/test/template/resolver_patterns_test.rb2
-rw-r--r--actionview/test/template/template_test.rb16
-rw-r--r--actionview/test/template/testing/fixture_resolver_test.rb2
-rw-r--r--actionview/test/template/testing/null_resolver_test.rb2
-rw-r--r--actionview/test/template/text_test.rb4
8 files changed, 24 insertions, 12 deletions
diff --git a/actionview/test/template/digestor_test.rb b/actionview/test/template/digestor_test.rb
index 91861edf11..7affd3c005 100644
--- a/actionview/test/template/digestor_test.rb
+++ b/actionview/test/template/digestor_test.rb
@@ -361,7 +361,7 @@ class TemplateDigestorTest < ActionView::TestCase
def tree_template_formats(template_name)
tree = ActionView::Digestor.tree(template_name, finder)
- tree.flatten.map(&:template).compact.flat_map(&:formats)
+ tree.flatten.map(&:template).compact.map(&:format)
end
def disable_resolver_caching
diff --git a/actionview/test/template/html_test.rb b/actionview/test/template/html_test.rb
index 5cdff74d60..c5fc8f906c 100644
--- a/actionview/test/template/html_test.rb
+++ b/actionview/test/template/html_test.rb
@@ -4,16 +4,16 @@ require "abstract_unit"
class HTMLTest < ActiveSupport::TestCase
test "formats returns symbol for recognized MIME type" do
- assert_equal [:html], ActionView::Template::HTML.new("", :html).formats
+ assert_equal :html, ActionView::Template::HTML.new("", :html).format
end
test "formats returns string for recognized MIME type when MIME does not have symbol" do
foo = Mime::Type.lookup("foo")
assert_nil foo.to_sym
- assert_equal ["foo"], ActionView::Template::HTML.new("", foo).formats
+ assert_equal "foo", ActionView::Template::HTML.new("", foo).format
end
test "formats returns string for unknown MIME type" do
- assert_equal ["foo"], ActionView::Template::HTML.new("", "foo").formats
+ assert_equal "foo", ActionView::Template::HTML.new("", "foo").format
end
end
diff --git a/actionview/test/template/lookup_context_test.rb b/actionview/test/template/lookup_context_test.rb
index 5298afb694..a763e24226 100644
--- a/actionview/test/template/lookup_context_test.rb
+++ b/actionview/test/template/lookup_context_test.rb
@@ -125,7 +125,7 @@ class LookupContextTest < ActiveSupport::TestCase
assert_called(ActionView::Template::Handlers::Builder, :default_format, returns: nil) do
@lookup_context.formats = [:text]
template = @lookup_context.find("hello", %w(test))
- assert_equal [:text], template.formats
+ assert_equal :text, template.format
end
end
diff --git a/actionview/test/template/resolver_patterns_test.rb b/actionview/test/template/resolver_patterns_test.rb
index 1e1a4c5063..38357aa10b 100644
--- a/actionview/test/template/resolver_patterns_test.rb
+++ b/actionview/test/template/resolver_patterns_test.rb
@@ -19,7 +19,7 @@ class ResolverPatternsTest < ActiveSupport::TestCase
assert_equal 1, templates.size, "expected one template"
assert_equal "Hello custom patterns!", templates.first.source
assert_equal "custom_pattern/path", templates.first.virtual_path
- assert_equal [:html], templates.first.formats
+ assert_equal :html, templates.first.format
end
def test_should_return_all_templates_when_ambiguous_pattern
diff --git a/actionview/test/template/template_test.rb b/actionview/test/template/template_test.rb
index a069c8f2d0..c74305fb42 100644
--- a/actionview/test/template/template_test.rb
+++ b/actionview/test/template/template_test.rb
@@ -38,7 +38,8 @@ class TestERBTemplate < ActiveSupport::TestCase
"<%= @virtual_path %>",
"partial",
ERBHandler,
- virtual_path: "partial"
+ virtual_path: "partial",
+ format: :html
)
end
@@ -55,7 +56,8 @@ class TestERBTemplate < ActiveSupport::TestCase
end
end
- def new_template(body = "<%= hello %>", details = { format: :html })
+ def new_template(body = "<%= hello %>", details = {})
+ details = { format: :html }.merge details
ActionView::Template.new(body.dup, "hello template", details.fetch(:handler) { ERBHandler }, { virtual_path: "hello" }.merge!(details))
end
@@ -213,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
diff --git a/actionview/test/template/testing/fixture_resolver_test.rb b/actionview/test/template/testing/fixture_resolver_test.rb
index 9954e3500d..4361824a71 100644
--- a/actionview/test/template/testing/fixture_resolver_test.rb
+++ b/actionview/test/template/testing/fixture_resolver_test.rb
@@ -15,6 +15,6 @@ class FixtureResolverTest < ActiveSupport::TestCase
assert_equal 1, templates.size, "expected one template"
assert_equal "this text", templates.first.source
assert_equal "arbitrary/path", templates.first.virtual_path
- assert_equal [:html], templates.first.formats
+ assert_equal :html, templates.first.format
end
end
diff --git a/actionview/test/template/testing/null_resolver_test.rb b/actionview/test/template/testing/null_resolver_test.rb
index 53364c1d90..dad8d0966d 100644
--- a/actionview/test/template/testing/null_resolver_test.rb
+++ b/actionview/test/template/testing/null_resolver_test.rb
@@ -9,6 +9,6 @@ class NullResolverTest < ActiveSupport::TestCase
assert_equal 1, templates.size, "expected one template"
assert_equal "Template generated by Null Resolver", templates.first.source
assert_equal "arbitrary/path.erb", templates.first.virtual_path.to_s
- assert_equal [:html], templates.first.formats
+ assert_equal :html, templates.first.format
end
end
diff --git a/actionview/test/template/text_test.rb b/actionview/test/template/text_test.rb
index 0c6470df21..c837c53587 100644
--- a/actionview/test/template/text_test.rb
+++ b/actionview/test/template/text_test.rb
@@ -3,8 +3,8 @@
require "abstract_unit"
class TextTest < ActiveSupport::TestCase
- test "formats always return :text" do
- assert_equal [:text], ActionView::Template::Text.new("").formats
+ test "format always return :text" do
+ assert_equal :text, ActionView::Template::Text.new("").format
end
test "identifier should return 'text template'" do