mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
this should have gone with the previous commit
This commit is contained in:
parent
f7627de206
commit
827fcf453e
2 changed files with 6 additions and 6 deletions
|
@ -158,17 +158,17 @@ module ActiveSupport #:nodoc:
|
|||
UNAVAILABLE_STRING_METHODS.each do |unavailable_method|
|
||||
class_eval <<-EOT, __FILE__, __LINE__
|
||||
# def gsub(*args)
|
||||
# raise NoMethodError, "gsub cannot be used with a safe string. You should use object.to_str.gsub."
|
||||
# raise NoMethodError, "gsub cannot be used with a safe string. You should use object.to_str.gsub"
|
||||
# end
|
||||
def #{unavailable_method}(*args)
|
||||
raise NoMethodError, "#{unavailable_method} cannot be used with a safe string. You should use object.to_str.#{unavailable_method}."
|
||||
raise NoMethodError, "#{unavailable_method} cannot be used with a safe string. You should use object.to_str.#{unavailable_method}"
|
||||
end
|
||||
|
||||
# def gsub!(*args)
|
||||
# raise NoMethodError, "gsub! cannot be used with a safe string. You should use object.to_str.gsub!."
|
||||
# raise NoMethodError, "gsub! cannot be used with a safe string. You should use object.to_str.gsub!"
|
||||
# end
|
||||
def #{unavailable_method}!(*args)
|
||||
raise NoMethodError, "#{unavailable_method}! cannot be used with a safe string. You should use object.to_str.#{unavailable_method}!."
|
||||
raise NoMethodError, "#{unavailable_method}! cannot be used with a safe string. You should use object.to_str.#{unavailable_method}!"
|
||||
end
|
||||
EOT
|
||||
end
|
||||
|
|
|
@ -114,13 +114,13 @@ class SafeBufferTest < ActiveSupport::TestCase
|
|||
|
||||
["gsub", "sub"].each do |unavailable_method|
|
||||
test "should raise on #{unavailable_method}" do
|
||||
assert_raise NoMethodError, "#{unavailable_method} cannot be used with a Safe Buffer object. You should use object.to_str.#{unavailable_method}" do
|
||||
assert_raise NoMethodError, "#{unavailable_method} cannot be used with a safe string. You should use object.to_str.#{unavailable_method}" do
|
||||
@buffer.send(unavailable_method, '', '<>')
|
||||
end
|
||||
end
|
||||
|
||||
test "should raise on #{unavailable_method}!" do
|
||||
assert_raise NoMethodError, "#{unavailable_method}! cannot be used with a Safe Buffer object. You should use object.to_str.#{unavailable_method}!" do
|
||||
assert_raise NoMethodError, "#{unavailable_method}! cannot be used with a safe string. You should use object.to_str.#{unavailable_method}!" do
|
||||
@buffer.send("#{unavailable_method}!", '', '<>')
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue