Skip to content

Commit

Permalink
Merge pull request #2 from adomokos/ad-uncomment-spec
Browse files Browse the repository at this point in the history
Uncomment ignored spec - works with latest code
  • Loading branch information
hsgubert authored May 24, 2018
2 parents ebc7ab2 + 3e02b63 commit 401fe57
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions spec/rails/sharding/active_record_extensions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,12 @@

describe '#using_shard method in associations' do
it 'should work for a has_many association' do
skip('doenst work for now')
new_account = Account.using_shard(:mysql_group, :shard1).create!
new_user = User.using_shard(:mysql_group, :shard1).create!(:username => 'test_username', :account_id => new_account.id)

# This test doesn't pass because when we access a relation AR tries to access
# the DB connection (before we switch the connection)

# new_account = Account.using_shard(:mysql_group, :shard1).create!
# new_user = User.using_shard(:mysql_group, :shard1).create!(:username => 'test_username', :account_id => new_account.id)
#
# new_account = Account.using_shard(:mysql_group, :shard1).first
# expect(new_account.users.using_shard(:mysql_group, :shard1).first).to be == new_user
# expect(new_account.users.using_shard(:mysql_group, :shard2).first).to be_nil
new_account = Account.using_shard(:mysql_group, :shard1).first
expect(new_account.users.using_shard(:mysql_group, :shard1).first).to be == new_user
expect(new_account.users.using_shard(:mysql_group, :shard2).first).to be_nil
end
end

Expand All @@ -101,6 +96,4 @@
expect(new_user.username).to be == 'another_username'
end
end


end

0 comments on commit 401fe57

Please sign in to comment.