From 45f8848ca7d7a1065c4c9f3d73946d908a382a9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Fri, 2 Dec 2016 16:42:37 -0500 Subject: Remove unused argument Now Text class is only used to render text mime type pages --- actionview/lib/action_view/template/text.rb | 7 +++---- actionview/test/template/text_test.rb | 14 ++------------ 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/actionview/lib/action_view/template/text.rb b/actionview/lib/action_view/template/text.rb index e8d4e18f04..380528d6ef 100644 --- a/actionview/lib/action_view/template/text.rb +++ b/actionview/lib/action_view/template/text.rb @@ -4,10 +4,9 @@ module ActionView #:nodoc: class Text #:nodoc: attr_accessor :type - def initialize(string, type = nil) + def initialize(string) @string = string.to_s - @type = Types[type] || type if type - @type ||= Types[:text] + @type = Types[:text] end def identifier @@ -25,7 +24,7 @@ module ActionView #:nodoc: end def formats - [@type.respond_to?(:ref) ? @type.ref : @type.to_s] + [@type.ref] end end end diff --git a/actionview/test/template/text_test.rb b/actionview/test/template/text_test.rb index 6510688f97..ee526dc367 100644 --- a/actionview/test/template/text_test.rb +++ b/actionview/test/template/text_test.rb @@ -1,17 +1,7 @@ require "abstract_unit" class TextTest < ActiveSupport::TestCase - test "formats returns symbol for recognized MIME type" do - assert_equal [:text], ActionView::Template::Text.new("", :text).formats - 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::Text.new("", foo).formats - end - - test "formats returns string for unknown MIME type" do - assert_equal ["foo"], ActionView::Template::Text.new("", "foo").formats + test "formats always return :text" do + assert_equal [:text], ActionView::Template::Text.new("").formats end end -- cgit v1.2.3