Skip to content

Commit

Permalink
fix default_shard spec
Browse files Browse the repository at this point in the history
  * ref: https://github.com/rails/rails/pull/48353/files
  * ActiveRecord has been modified to use default_shards estimation with keys.first of connects_to hash
  • Loading branch information
fumihumi committed Oct 25, 2023
1 parent 9c27af6 commit a80d8a3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions spec/octoball/model_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@

it 'should clean #current_shard from proxy when using execute' do
User.using(:canada).connection.execute('select * from users limit 1;')
expect(User.connection.current_shard).to eq(:default)
expect(User.connection.current_shard).to eq(:master)
end

it 'should allow scoping dynamically' do
Expand Down Expand Up @@ -264,7 +264,7 @@

describe 'AR basic methods' do
it 'connects_to' do
expect(CustomConnection.connection.current_database).to eq('octoball_shard_2')
expect(CustomConnection.connection.current_database).to eq('octoball_shard_3')
end

it 'reuses parent model connection' do
Expand Down Expand Up @@ -590,7 +590,7 @@
describe 'custom connection' do
context 'by default' do
it 'with plain call should use custom connection' do
expect(CustomConnection.connection.current_database).to eq('octoball_shard_2')
expect(CustomConnection.connection.current_database).to eq('octoball_shard_3')
end

it 'should use model-specific shard' do
Expand Down

0 comments on commit a80d8a3

Please sign in to comment.