Skip to content

Commit

Permalink
Rubocoping
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardo-angeles-skydropx committed Jan 27, 2025
1 parent 9d6aca4 commit 90bbde2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/pg_rls/admin.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# frozen_string_literal: true

module PgRls
# Admin Module
# The admin module provides the admin_execute method to execute
# queries on the admin shard.
module Admin
def self.admin_execute(sql = nil)
PgRls::Record.connected_to(shard: :admin) do
Expand Down
3 changes: 2 additions & 1 deletion test/pg_rls/admin_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ class PgRlsAdminTest < ActiveSupport::TestCase

test "admin_execute configures the connection to use the admin shard" do
PgRls.stub :connects_to, { shards: { admin: { writing: :admin, reading: :admin } } } do
assert_equal "primary", PgRls::Admin.admin_execute { ::ActiveRecord::Base.connection_db_config.name }
result = PgRls::Admin.admin_execute { ::ActiveRecord::Base.connection_db_config.name }
assert_equal "primary", result
end
end
end

0 comments on commit 90bbde2

Please sign in to comment.