diff options
author | Xavier Noria <fxn@hashref.com> | 2016-08-06 19:35:13 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2016-08-06 19:35:13 +0200 |
commit | 5b6eb1d58b48fada298215b2cccda89f993890c3 (patch) | |
tree | a48010fd8c35588540f50df257a76347091aca12 /actionpack/test/dispatch/uploaded_file_test.rb | |
parent | 12a70404cd164008879e63cc320356e6afee3adc (diff) | |
download | rails-5b6eb1d58b48fada298215b2cccda89f993890c3.tar.gz rails-5b6eb1d58b48fada298215b2cccda89f993890c3.tar.bz2 rails-5b6eb1d58b48fada298215b2cccda89f993890c3.zip |
modernizes hash syntax in actionpack
Diffstat (limited to 'actionpack/test/dispatch/uploaded_file_test.rb')
-rw-r--r-- | actionpack/test/dispatch/uploaded_file_test.rb | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/actionpack/test/dispatch/uploaded_file_test.rb b/actionpack/test/dispatch/uploaded_file_test.rb index 63d8cda9a0..60d0246a68 100644 --- a/actionpack/test/dispatch/uploaded_file_test.rb +++ b/actionpack/test/dispatch/uploaded_file_test.rb @@ -9,81 +9,81 @@ module ActionDispatch end def test_original_filename - uf = Http::UploadedFile.new(:filename => "foo", :tempfile => Object.new) + uf = Http::UploadedFile.new(filename: "foo", tempfile: Object.new) assert_equal "foo", uf.original_filename end def test_filename_should_be_in_utf_8 - uf = Http::UploadedFile.new(:filename => "foo", :tempfile => Object.new) + uf = Http::UploadedFile.new(filename: "foo", tempfile: Object.new) assert_equal "UTF-8", uf.original_filename.encoding.to_s end def test_filename_should_always_be_in_utf_8 - uf = Http::UploadedFile.new(:filename => "foo".encode(Encoding::SHIFT_JIS), - :tempfile => Object.new) + uf = Http::UploadedFile.new(filename: "foo".encode(Encoding::SHIFT_JIS), + tempfile: Object.new) assert_equal "UTF-8", uf.original_filename.encoding.to_s end def test_content_type - uf = Http::UploadedFile.new(:type => "foo", :tempfile => Object.new) + uf = Http::UploadedFile.new(type: "foo", tempfile: Object.new) assert_equal "foo", uf.content_type end def test_headers - uf = Http::UploadedFile.new(:head => "foo", :tempfile => Object.new) + uf = Http::UploadedFile.new(head: "foo", tempfile: Object.new) assert_equal "foo", uf.headers end def test_tempfile - uf = Http::UploadedFile.new(:tempfile => "foo") + uf = Http::UploadedFile.new(tempfile: "foo") assert_equal "foo", uf.tempfile end def test_to_io_returns_the_tempfile tf = Object.new - uf = Http::UploadedFile.new(:tempfile => tf) + uf = Http::UploadedFile.new(tempfile: tf) assert_equal tf, uf.to_io end def test_delegates_path_to_tempfile tf = Class.new { def path; "thunderhorse" end } - uf = Http::UploadedFile.new(:tempfile => tf.new) + uf = Http::UploadedFile.new(tempfile: tf.new) assert_equal "thunderhorse", uf.path end def test_delegates_open_to_tempfile tf = Class.new { def open; "thunderhorse" end } - uf = Http::UploadedFile.new(:tempfile => tf.new) + uf = Http::UploadedFile.new(tempfile: tf.new) assert_equal "thunderhorse", uf.open end def test_delegates_close_to_tempfile tf = Class.new { def close(unlink_now=false); "thunderhorse" end } - uf = Http::UploadedFile.new(:tempfile => tf.new) + uf = Http::UploadedFile.new(tempfile: tf.new) assert_equal "thunderhorse", uf.close end def test_close_accepts_parameter tf = Class.new { def close(unlink_now=false); "thunderhorse: #{unlink_now}" end } - uf = Http::UploadedFile.new(:tempfile => tf.new) + uf = Http::UploadedFile.new(tempfile: tf.new) assert_equal "thunderhorse: true", uf.close(true) end def test_delegates_read_to_tempfile tf = Class.new { def read(length=nil, buffer=nil); "thunderhorse" end } - uf = Http::UploadedFile.new(:tempfile => tf.new) + uf = Http::UploadedFile.new(tempfile: tf.new) assert_equal "thunderhorse", uf.read end def test_delegates_read_to_tempfile_with_params tf = Class.new { def read(length=nil, buffer=nil); [length, buffer] end } - uf = Http::UploadedFile.new(:tempfile => tf.new) + uf = Http::UploadedFile.new(tempfile: tf.new) assert_equal %w{ thunder horse }, uf.read(*%w{ thunder horse }) end def test_delegate_respects_respond_to? tf = Class.new { def read; yield end; private :read } - uf = Http::UploadedFile.new(:tempfile => tf.new) + uf = Http::UploadedFile.new(tempfile: tf.new) assert_raises(NoMethodError) do uf.read end @@ -91,13 +91,13 @@ module ActionDispatch def test_delegate_eof_to_tempfile tf = Class.new { def eof?; true end; } - uf = Http::UploadedFile.new(:tempfile => tf.new) + uf = Http::UploadedFile.new(tempfile: tf.new) assert uf.eof? end def test_respond_to? tf = Class.new { def read; yield end } - uf = Http::UploadedFile.new(:tempfile => tf.new) + uf = Http::UploadedFile.new(tempfile: tf.new) assert uf.respond_to?(:headers), "responds to headers" assert uf.respond_to?(:read), "responds to read" end |