Skip to content

Commit a923a68

Browse files
authored
Fix redefined method warnings (#1123)
1 parent a6b3734 commit a923a68

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
nbproject/
2-
debug.log
2+
debug.log*
33
.DS_Store
44
pkg/
55
doc/

test/cases/coerced_tests.rb

+8-1
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,7 @@ module ConnectionAdapters
778778
module ActiveRecord
779779
# The original module is hardcoded for PostgreSQL/SQLite/MySQL tests.
780780
module DatabaseTasksSetupper
781+
undef_method :setup
781782
def setup
782783
@sqlserver_tasks =
783784
Class.new do
@@ -800,6 +801,7 @@ def structure_load(*); end
800801
$stderr, @original_stderr = StringIO.new, $stderr
801802
end
802803

804+
undef_method :with_stubbed_new
803805
def with_stubbed_new
804806
ActiveRecord::Tasks::SQLServerDatabaseTasks.stub(:new, @sqlserver_tasks) do
805807
yield
@@ -1953,8 +1955,9 @@ def with_marshable_time_defaults
19531955
end
19541956

19551957
# We need to give the full path for this to work.
1958+
undef_method :schema_dump_path
19561959
def schema_dump_path
1957-
File.join ARTest::SQLServer.root_activerecord, "test/assets/schema_dump_5_1.yml"
1960+
File.join(ARTest::SQLServer.root_activerecord, "test/assets/schema_dump_5_1.yml")
19581961
end
19591962
end
19601963
end
@@ -2306,6 +2309,7 @@ class ReloadModelsTest < ActiveRecord::TestCase
23062309
class MarshalSerializationTest < ActiveRecord::TestCase
23072310
private
23082311

2312+
undef_method :marshal_fixture_path
23092313
def marshal_fixture_path(file_name)
23102314
File.expand_path(
23112315
"support/marshal_compatibility_fixtures/#{ActiveRecord::Base.connection.adapter_name}/#{file_name}.dump",
@@ -2561,6 +2565,7 @@ module ActiveRecord
25612565
class Migration
25622566
class InvalidOptionsTest < ActiveRecord::TestCase
25632567
# Include the additional SQL Server migration options.
2568+
undef_method :invalid_add_column_option_exception_message
25642569
def invalid_add_column_option_exception_message(key)
25652570
default_keys = [":limit", ":precision", ":scale", ":default", ":null", ":collation", ":comment", ":primary_key", ":if_exists", ":if_not_exists"]
25662571
default_keys.concat([":is_identity"]) # SQL Server additional valid keys
@@ -2573,6 +2578,7 @@ def invalid_add_column_option_exception_message(key)
25732578

25742579
# SQL Server does not support upsert. Removed dependency on `insert_all` that uses upsert.
25752580
class ActiveRecord::Encryption::ConcurrencyTest < ActiveRecord::EncryptionTestCase
2581+
undef_method :thread_encrypting_and_decrypting
25762582
def thread_encrypting_and_decrypting(thread_label)
25772583
posts = 100.times.collect { |index| EncryptedPost.create! title: "Article #{index} (#{thread_label})", body: "Body #{index} (#{thread_label})" }
25782584

@@ -2590,6 +2596,7 @@ def thread_encrypting_and_decrypting(thread_label)
25902596
# can read and write `ActiveRecord::ConnectionAdapters::SQLServer::Type::Data` objects.
25912597
class ActiveRecordMessagePackTest < ActiveRecord::TestCase
25922598
private
2599+
undef_method :serializer
25932600
def serializer
25942601
@serializer ||= ::MessagePack::Factory.new.tap do |factory|
25952602
ActiveRecord::MessagePack::Extensions.install(factory)

test/cases/disconnected_test_sqlserver.rb

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
class TestDisconnectedAdapter < ActiveRecord::TestCase
66
self.use_transactional_tests = false
77

8+
undef_method :setup
89
def setup
910
@connection = ActiveRecord::Base.connection
1011
end

test/cases/helper_sqlserver.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def ensure_clean_rails_env
3838
def remove_backtrace_silencers
3939
Rails.backtrace_cleaner.remove_silencers!
4040
end
41-
41+
4242
# Cleanup the SQLite database created by previous runs of the Rails ActiveRecord test suite.
4343
def cleanup_sqlite_databases
4444
sqlite_db_dir = File.join(ARTest::SQLServer.test_root_sqlserver, "db")

test/cases/rake_test_sqlserver.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class SQLServerRakeSchemaCacheDumpLoadTest < SQLServerRakeTest
177177
quietly { db_tasks.dump_schema_cache connection, filename }
178178

179179
filedata = File.read(filename)
180-
schema_cache = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(filedata) : YAML.load(filedata)
180+
_schema_cache = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(filedata) : YAML.load(filedata)
181181

182182
col_id, col_name = connection.schema_cache.columns("users")
183183

0 commit comments

Comments
 (0)