提交 47f54591 编写于 作者: A Akira Matsuda

Module#const_set is a public method

上级 31197f20
......@@ -49,7 +49,7 @@ def test_mailbox_skeleton_is_created_with_namespace
end
def test_check_class_collision
Object.send :const_set, :InboxMailbox, Class.new
Object.const_set :InboxMailbox, Class.new
content = capture(:stderr) { run_generator }
assert_match(/The name 'InboxMailbox' is either already used in your application or reserved/, content)
ensure
......
......@@ -58,7 +58,7 @@ def setup_connection
ActiveRecord::Base.configurations = { "sqlite3_ar_integration" => options }
ActiveRecord::Base.connection
Object.send(:const_set, :QUOTED_TYPE, ActiveRecord::Base.connection.quote_column_name("type")) unless Object.const_defined?(:QUOTED_TYPE)
Object.const_set :QUOTED_TYPE, ActiveRecord::Base.connection.quote_column_name("type") unless Object.const_defined?(:QUOTED_TYPE)
else
raise "Can't setup connection since ActiveRecord isn't loaded."
end
......
......@@ -253,7 +253,7 @@ class MyClass < ApplicationRecord
end
def test_connection_specification_name_should_fallback_to_parent
Object.send :const_set, :ApplicationRecord, ApplicationRecord
Object.const_set :ApplicationRecord, ApplicationRecord
klassA = Class.new(Base)
klassB = Class.new(klassA)
......
......@@ -24,7 +24,7 @@ def setup
teardown do
# reinstate the constants that we undefined in the setup
@undefined_consts.each do |constant, value|
Object.send :const_set, constant, value unless value.nil?
Object.const_set constant, value unless value.nil?
end
ActiveRecord::Base.store_full_sti_class = true
......
......@@ -20,7 +20,7 @@ def test_controller_skeleton_is_created
end
def test_check_class_collision
Object.send :const_set, :ObjectController, Class.new
Object.const_set :ObjectController, Class.new
content = capture(:stderr) { run_generator ["object"] }
assert_match(/The name 'ObjectController' is either already used in your application or reserved/, content)
ensure
......
......@@ -31,7 +31,7 @@ def test_mailer_with_i18n_helper
end
def test_check_class_collision
Object.send :const_set, :NotifierMailer, Class.new
Object.const_set :NotifierMailer, Class.new
content = capture(:stderr) { run_generator }
assert_match(/The name 'NotifierMailer' is either already used in your application or reserved/, content)
ensure
......@@ -60,7 +60,7 @@ def test_invokes_default_test_framework
end
def test_check_test_class_collision
Object.send :const_set, :NotifierMailerTest, Class.new
Object.const_set :NotifierMailerTest, Class.new
content = capture(:stderr) { run_generator }
assert_match(/The name 'NotifierMailerTest' is either already used in your application or reserved/, content)
ensure
......@@ -68,7 +68,7 @@ def test_check_test_class_collision
end
def test_check_preview_class_collision
Object.send :const_set, :NotifierMailerPreview, Class.new
Object.const_set :NotifierMailerPreview, Class.new
content = capture(:stderr) { run_generator }
assert_match(/The name 'NotifierMailerPreview' is either already used in your application or reserved/, content)
ensure
......
......@@ -323,7 +323,7 @@ def test_api_only_generates_params_for_attachments
end
def test_check_class_collision
Object.send :const_set, :UsersController, Class.new
Object.const_set :UsersController, Class.new
content = capture(:stderr) { run_generator }
assert_match(/The name 'UsersController' is either already used in your application or reserved/, content)
ensure
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册