Ruby 1.9 compat: encoding and multibyte test fixes
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9194 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
300c927b6c
commit
30fa377f33
@ -186,9 +186,7 @@ def default_layout(format) #:nodoc:
|
||||
end
|
||||
|
||||
def layout_list #:nodoc:
|
||||
view_paths.collect do |path|
|
||||
Dir["#{path}/layouts/**/*"]
|
||||
end.flatten
|
||||
Array(view_paths).sum([]) { |path| Dir["#{path}/layouts/**/*"] }
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -835,8 +835,10 @@ def test_mixed_files
|
||||
assert_equal 'bar', params['foo']
|
||||
|
||||
# Ruby CGI doesn't handle multipart/mixed for us.
|
||||
assert_kind_of String, params['files']
|
||||
assert_equal 19756, params['files'].size
|
||||
files = params['files']
|
||||
assert_kind_of String, files
|
||||
files.force_encoding('ASCII-8BIT') if files.respond_to?(:force_encoding)
|
||||
assert_equal 19756, files.size
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -136,16 +136,16 @@ def test_excerpt_with_regex
|
||||
if RUBY_VERSION < '1.9'
|
||||
def test_excerpt_with_utf8
|
||||
with_kcode('u') do
|
||||
assert_equal("...fficiency could not be...", excerpt("That's why efficiency could not be helped", 'could', 8))
|
||||
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 efficiency could not be helped", 'could', 8))
|
||||
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("...fficiency could not be...".force_encoding('UTF-8'), excerpt("That's why efficiency could not be helped".force_encoding('UTF-8'), 'could', 8))
|
||||
assert_equal("...\203ciency could not be...", excerpt("That's why efficiency could not be helped", 'could', 8))
|
||||
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))
|
||||
assert_equal("...\203ciency could not be...", excerpt("That's why e\357\254\203ciency could not be helped", 'could', 8))
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user