Skip to content

Commit 5f0e5ca

Browse files
Copilotka8725
andcommitted
Rebase on main and fix rubocop offenses
Co-authored-by: ka8725 <243846+ka8725@users.noreply.github.com>
1 parent f51ec37 commit 5f0e5ca

File tree

3 files changed

+31
-31
lines changed

3 files changed

+31
-31
lines changed

Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ GEM
8989
bundler
9090
rake
9191
thor (>= 0.14.0)
92-
ast (2.4.2)
92+
ast (2.4.3)
9393
base64 (0.1.1)
9494
bigdecimal (3.1.4)
9595
builder (3.2.4)
@@ -143,13 +143,13 @@ GEM
143143
nokogiri (1.15.4-x86_64-linux)
144144
racc (~> 1.4)
145145
parallel (1.23.0)
146-
parser (3.2.2.4)
146+
parser (3.3.10.1)
147147
ast (~> 2.4.1)
148148
racc
149149
prism (1.8.0)
150150
psych (5.1.1.1)
151151
stringio
152-
racc (1.7.3)
152+
racc (1.8.1)
153153
rack (3.0.8)
154154
rack-session (2.0.0)
155155
rack (>= 3.0.0)

lib/actual_db_schema/migration_context.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ def configs
3131
end
3232

3333
def filter_configs(all_configs)
34-
all_configs.select do |db_config|
34+
all_configs.reject do |db_config|
3535
# Skip if database is in the excluded list
3636
db_name = db_config.respond_to?(:name) ? db_config.name.to_sym : :primary
37-
!ActualDbSchema.config.excluded_databases.include?(db_name)
37+
ActualDbSchema.config.excluded_databases.include?(db_name)
3838
end
3939
end
4040

test/test_database_filtering.rb

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@
2121
utils.reset_database_yml(db_config)
2222
ActiveRecord::Base.configurations = { "test" => db_config }
2323
ActiveRecord::Tasks::DatabaseTasks.database_configuration = { "test" => db_config }
24-
24+
2525
# Configure to exclude secondary database
2626
ActualDbSchema.config.excluded_databases = [:secondary]
27-
27+
2828
# Get the migration context instance
2929
context = ActualDbSchema::MigrationContext.instance
30-
30+
3131
# Verify only primary database is included
3232
configs = context.send(:configs)
3333
config_names = configs.map { |c| c.respond_to?(:name) ? c.name.to_sym : :primary }
34-
34+
3535
assert_includes config_names, :primary
3636
refute_includes config_names, :secondary
3737
end
@@ -46,21 +46,21 @@
4646
"migrations_paths" => Rails.root.join("db", "migrate_queue").to_s
4747
}
4848
}
49-
49+
5050
utils.reset_database_yml(db_config)
5151
ActiveRecord::Base.configurations = { "test" => db_config }
5252
ActiveRecord::Tasks::DatabaseTasks.database_configuration = { "test" => db_config }
53-
53+
5454
# Configure to exclude secondary and queue databases
55-
ActualDbSchema.config.excluded_databases = [:secondary, :queue]
56-
55+
ActualDbSchema.config.excluded_databases = %i[secondary queue]
56+
5757
# Get the migration context instance
5858
context = ActualDbSchema::MigrationContext.instance
59-
59+
6060
# Verify only primary database is included
6161
configs = context.send(:configs)
6262
config_names = configs.map { |c| c.respond_to?(:name) ? c.name.to_sym : :primary }
63-
63+
6464
assert_includes config_names, :primary
6565
refute_includes config_names, :secondary
6666
refute_includes config_names, :queue
@@ -71,13 +71,13 @@
7171
utils.reset_database_yml(db_config)
7272
ActiveRecord::Base.configurations = { "test" => db_config }
7373
ActiveRecord::Tasks::DatabaseTasks.database_configuration = { "test" => db_config }
74-
74+
7575
ActualDbSchema.config.excluded_databases = []
76-
76+
7777
context = ActualDbSchema::MigrationContext.instance
7878
configs = context.send(:configs)
7979
config_names = configs.map { |c| c.respond_to?(:name) ? c.name.to_sym : :primary }
80-
80+
8181
assert_includes config_names, :primary
8282
assert_includes config_names, :secondary
8383
end
@@ -86,49 +86,49 @@
8686
describe "environment variable ACTUAL_DB_SCHEMA_EXCLUDED_DATABASES" do
8787
it "parses comma-separated database names from environment variable" do
8888
ENV["ACTUAL_DB_SCHEMA_EXCLUDED_DATABASES"] = "queue,cable"
89-
89+
9090
# Create a new configuration to pick up the env var
9191
config = ActualDbSchema::Configuration.new
92-
93-
assert_equal [:queue, :cable], config.excluded_databases
92+
93+
assert_equal %i[queue cable], config.excluded_databases
9494
ensure
9595
ENV.delete("ACTUAL_DB_SCHEMA_EXCLUDED_DATABASES")
9696
end
9797

9898
it "handles whitespace in environment variable" do
9999
ENV["ACTUAL_DB_SCHEMA_EXCLUDED_DATABASES"] = "queue, cable, cache"
100-
100+
101101
config = ActualDbSchema::Configuration.new
102-
103-
assert_equal [:queue, :cable, :cache], config.excluded_databases
102+
103+
assert_equal %i[queue cable cache], config.excluded_databases
104104
ensure
105105
ENV.delete("ACTUAL_DB_SCHEMA_EXCLUDED_DATABASES")
106106
end
107107

108108
it "returns empty array when environment variable is not set" do
109109
ENV.delete("ACTUAL_DB_SCHEMA_EXCLUDED_DATABASES")
110-
110+
111111
config = ActualDbSchema::Configuration.new
112-
112+
113113
assert_equal [], config.excluded_databases
114114
end
115115

116116
it "handles empty string in environment variable" do
117117
ENV["ACTUAL_DB_SCHEMA_EXCLUDED_DATABASES"] = ""
118-
118+
119119
config = ActualDbSchema::Configuration.new
120-
120+
121121
assert_equal [], config.excluded_databases
122122
ensure
123123
ENV.delete("ACTUAL_DB_SCHEMA_EXCLUDED_DATABASES")
124124
end
125125

126126
it "filters out empty values from comma-separated list" do
127127
ENV["ACTUAL_DB_SCHEMA_EXCLUDED_DATABASES"] = "queue,,cable, ,cache"
128-
128+
129129
config = ActualDbSchema::Configuration.new
130-
131-
assert_equal [:queue, :cable, :cache], config.excluded_databases
130+
131+
assert_equal %i[queue cable cache], config.excluded_databases
132132
ensure
133133
ENV.delete("ACTUAL_DB_SCHEMA_EXCLUDED_DATABASES")
134134
end

0 commit comments

Comments
 (0)