diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-12-02 16:42:37 -0500 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-12-02 16:42:37 -0500 |
commit | 45f8848ca7d7a1065c4c9f3d73946d908a382a9d (patch) | |
tree | c541295a82ca80ff38f256a095e576fc238c706f | |
parent | 8ce903af862d56b77d60c3809c0442cdac9d6c89 (diff) | |
download | rails-45f8848ca7d7a1065c4c9f3d73946d908a382a9d.tar.gz rails-45f8848ca7d7a1065c4c9f3d73946d908a382a9d.tar.bz2 rails-45f8848ca7d7a1065c4c9f3d73946d908a382a9d.zip |
Remove unused argument
Now Text class is only used to render text mime type pages
-rw-r--r-- | actionview/lib/action_view/template/text.rb | 7 | ||||
-rw-r--r-- | 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 |