mirror of https://github.com/rails/rails
Merge pull request #4088 from rahul100885/rahul100885_work
Remove unused conditions for 1.9
This commit is contained in:
commit
49f08bb50c
|
@ -665,13 +665,8 @@ XML
|
|||
|
||||
FILES_DIR = File.dirname(__FILE__) + '/../fixtures/multipart'
|
||||
|
||||
if RUBY_VERSION < '1.9'
|
||||
READ_BINARY = 'rb'
|
||||
READ_PLAIN = 'r'
|
||||
else
|
||||
READ_BINARY = 'rb:binary'
|
||||
READ_PLAIN = 'r:binary'
|
||||
end
|
||||
READ_BINARY = 'rb:binary'
|
||||
READ_PLAIN = 'r:binary'
|
||||
|
||||
def test_test_uploaded_file
|
||||
filename = 'mona_lisa.jpg'
|
||||
|
|
|
@ -131,17 +131,15 @@ class CaptureHelperTest < ActionView::TestCase
|
|||
assert buffer.equal?(@av.output_buffer)
|
||||
end
|
||||
|
||||
unless RUBY_VERSION < '1.9'
|
||||
def test_with_output_buffer_sets_proper_encoding
|
||||
@av.output_buffer = ActionView::OutputBuffer.new
|
||||
def test_with_output_buffer_sets_proper_encoding
|
||||
@av.output_buffer = ActionView::OutputBuffer.new
|
||||
|
||||
# Ensure we set the output buffer to an encoding different than the default one.
|
||||
alt_encoding = alt_encoding(@av.output_buffer)
|
||||
@av.output_buffer.force_encoding(alt_encoding)
|
||||
# Ensure we set the output buffer to an encoding different than the default one.
|
||||
alt_encoding = alt_encoding(@av.output_buffer)
|
||||
@av.output_buffer.force_encoding(alt_encoding)
|
||||
|
||||
@av.with_output_buffer do
|
||||
assert_equal alt_encoding, @av.output_buffer.encoding
|
||||
end
|
||||
@av.with_output_buffer do
|
||||
assert_equal alt_encoding, @av.output_buffer.encoding
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -165,14 +163,12 @@ class CaptureHelperTest < ActionView::TestCase
|
|||
assert_equal '', view.output_buffer
|
||||
end
|
||||
|
||||
unless RUBY_VERSION < '1.9'
|
||||
def test_flush_output_buffer_preserves_the_encoding_of_the_output_buffer
|
||||
view = view_with_controller
|
||||
alt_encoding = alt_encoding(view.output_buffer)
|
||||
view.output_buffer.force_encoding(alt_encoding)
|
||||
flush_output_buffer
|
||||
assert_equal alt_encoding, view.output_buffer.encoding
|
||||
end
|
||||
def test_flush_output_buffer_preserves_the_encoding_of_the_output_buffer
|
||||
view = view_with_controller
|
||||
alt_encoding = alt_encoding(view.output_buffer)
|
||||
view.output_buffer.force_encoding(alt_encoding)
|
||||
flush_output_buffer
|
||||
assert_equal alt_encoding, view.output_buffer.encoding
|
||||
end
|
||||
|
||||
def alt_encoding(output_buffer)
|
||||
|
|
|
@ -82,25 +82,13 @@ class TextHelperTest < ActionView::TestCase
|
|||
assert_equal "Hello Big[...]", truncate("Hello Big World!", :omission => "[...]", :length => 15, :separator => ' ')
|
||||
end
|
||||
|
||||
if RUBY_VERSION < '1.9.0'
|
||||
def test_truncate_multibyte
|
||||
with_kcode 'none' do
|
||||
assert_equal "\354\225\210\353\205\225\355...", truncate("\354\225\210\353\205\225\355\225\230\354\204\270\354\232\224", :length => 10)
|
||||
end
|
||||
with_kcode 'u' do
|
||||
assert_equal "\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 ...",
|
||||
truncate("\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 \354\225\204\353\235\274\353\246\254\354\230\244", :length => 10)
|
||||
end
|
||||
end
|
||||
else
|
||||
def test_truncate_multibyte
|
||||
# .mb_chars always returns a UTF-8 String.
|
||||
# assert_equal "\354\225\210\353\205\225\355...",
|
||||
# truncate("\354\225\210\353\205\225\355\225\230\354\204\270\354\232\224", :length => 10)
|
||||
def test_truncate_multibyte
|
||||
# .mb_chars always returns a UTF-8 String.
|
||||
# assert_equal "\354\225\210\353\205\225\355...",
|
||||
# truncate("\354\225\210\353\205\225\355\225\230\354\204\270\354\232\224", :length => 10)
|
||||
|
||||
assert_equal "\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 ...".force_encoding('UTF-8'),
|
||||
truncate("\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 \354\225\204\353\235\274\353\246\254\354\230\244".force_encoding('UTF-8'), :length => 10)
|
||||
end
|
||||
assert_equal "\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 ...".force_encoding('UTF-8'),
|
||||
truncate("\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 \354\225\204\353\235\274\353\246\254\354\230\244".force_encoding('UTF-8'), :length => 10)
|
||||
end
|
||||
|
||||
def test_highlight_should_be_html_safe
|
||||
|
@ -243,21 +231,10 @@ class TextHelperTest < ActionView::TestCase
|
|||
)
|
||||
end
|
||||
|
||||
if RUBY_VERSION < '1.9'
|
||||
def test_excerpt_with_utf8
|
||||
with_kcode('u') do
|
||||
assert_equal("...\357\254\203ciency could not be...", excerpt("That's why e\357\254\203ciency could not be helped", 'could', 8))
|
||||
end
|
||||
with_kcode('none') do
|
||||
assert_equal("...\203ciency could not be...", excerpt("That's why e\357\254\203ciency could not be helped", 'could', 8))
|
||||
end
|
||||
end
|
||||
else
|
||||
def test_excerpt_with_utf8
|
||||
assert_equal("...\357\254\203ciency could not be...".force_encoding('UTF-8'), excerpt("That's why e\357\254\203ciency could not be helped".force_encoding('UTF-8'), 'could', 8))
|
||||
# .mb_chars always returns UTF-8, even in 1.9. This is not great, but it's how it works. Let's work this out.
|
||||
# assert_equal("...\203ciency could not be...", excerpt("That's why e\357\254\203ciency could not be helped".force_encoding("BINARY"), 'could', 8))
|
||||
end
|
||||
def test_excerpt_with_utf8
|
||||
assert_equal("...\357\254\203ciency could not be...".force_encoding('UTF-8'), excerpt("That's why e\357\254\203ciency could not be helped".force_encoding('UTF-8'), 'could', 8))
|
||||
# .mb_chars always returns UTF-8, even in 1.9. This is not great, but it's how it works. Let's work this out.
|
||||
# assert_equal("...\203ciency could not be...", excerpt("That's why e\357\254\203ciency could not be helped".force_encoding("BINARY"), 'could', 8))
|
||||
end
|
||||
|
||||
def test_word_wrap
|
||||
|
|
Loading…
Reference in New Issue