提交 414008f9 编写于 作者: K kennyj

Fix class_eval without __FILE__ and __LINE__.

上级 15bfaa3d
...@@ -333,7 +333,7 @@ def define_mounted_helper(name) ...@@ -333,7 +333,7 @@ def define_mounted_helper(name)
end end
end end
MountedHelpers.class_eval <<-RUBY MountedHelpers.class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
def #{name} def #{name}
@#{name} ||= _#{name} @#{name} ||= _#{name}
end end
......
...@@ -1467,7 +1467,7 @@ def test_creating_using_primary_key ...@@ -1467,7 +1467,7 @@ def test_creating_using_primary_key
def test_defining_has_many_association_with_delete_all_dependency_lazily_evaluates_target_class def test_defining_has_many_association_with_delete_all_dependency_lazily_evaluates_target_class
ActiveRecord::Reflection::AssociationReflection.any_instance.expects(:class_name).never ActiveRecord::Reflection::AssociationReflection.any_instance.expects(:class_name).never
class_eval <<-EOF class_eval(<<-EOF, __FILE__, __LINE__ + 1)
class DeleteAllModel < ActiveRecord::Base class DeleteAllModel < ActiveRecord::Base
has_many :nonentities, :dependent => :delete_all has_many :nonentities, :dependent => :delete_all
end end
...@@ -1476,7 +1476,7 @@ class DeleteAllModel < ActiveRecord::Base ...@@ -1476,7 +1476,7 @@ class DeleteAllModel < ActiveRecord::Base
def test_defining_has_many_association_with_nullify_dependency_lazily_evaluates_target_class def test_defining_has_many_association_with_nullify_dependency_lazily_evaluates_target_class
ActiveRecord::Reflection::AssociationReflection.any_instance.expects(:class_name).never ActiveRecord::Reflection::AssociationReflection.any_instance.expects(:class_name).never
class_eval <<-EOF class_eval(<<-EOF, __FILE__, __LINE__ + 1)
class NullifyModel < ActiveRecord::Base class NullifyModel < ActiveRecord::Base
has_many :nonentities, :dependent => :nullify has_many :nonentities, :dependent => :nullify
end end
......
...@@ -816,7 +816,7 @@ def in_time_zone(zone) ...@@ -816,7 +816,7 @@ def in_time_zone(zone)
end end
def privatize(method_signature) def privatize(method_signature)
@target.class_eval <<-private_method @target.class_eval(<<-private_method, __FILE__, __LINE__ + 1)
private private
def #{method_signature} def #{method_signature}
"I'm private" "I'm private"
......
...@@ -110,7 +110,7 @@ def test_split_should_return_an_array_of_chars_instances ...@@ -110,7 +110,7 @@ def test_split_should_return_an_array_of_chars_instances
end end
%w{capitalize downcase lstrip reverse rstrip swapcase upcase}.each do |method| %w{capitalize downcase lstrip reverse rstrip swapcase upcase}.each do |method|
class_eval(<<-EOTESTS) class_eval(<<-EOTESTS, __FILE__, __LINE__ + 1)
def test_#{method}_bang_should_return_self_when_modifying_wrapped_string def test_#{method}_bang_should_return_self_when_modifying_wrapped_string
chars = ' él piDió Un bUen café ' chars = ' él piDió Un bUen café '
assert_equal chars.object_id, chars.send("#{method}!").object_id assert_equal chars.object_id, chars.send("#{method}!").object_id
......
...@@ -167,7 +167,7 @@ def test_nested_fallbacks_for_generators ...@@ -167,7 +167,7 @@ def test_nested_fallbacks_for_generators
def test_developer_options_are_overwriten_by_user_options def test_developer_options_are_overwriten_by_user_options
Rails::Generators.options[:with_options] = { :generate => false } Rails::Generators.options[:with_options] = { :generate => false }
self.class.class_eval <<-end_eval self.class.class_eval(<<-end_eval, __FILE__, __LINE__ + 1)
class WithOptionsGenerator < Rails::Generators::Base class WithOptionsGenerator < Rails::Generators::Base
class_option :generate, :default => true class_option :generate, :default => true
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册