[Tests] Fix pool tests

The atomic add! and remove! methods were not properly resetting
the skip_sync property once the pool was updated. This was causing
pool test behavior to fail because later syncronize methods would
fail to sync.
This commit is contained in:
Kira 2021-02-05 21:02:18 -08:00
parent dbb5870d93
commit 2f416b51b4
2 changed files with 4 additions and 2 deletions

View File

@ -255,6 +255,7 @@ class Pool < ApplicationRecord
reload
self.skip_sync = true
update(post_ids: post_ids + [post.id])
self.skip_sync = false
post.add_pool!(self, true)
post.save
end
@ -276,6 +277,7 @@ class Pool < ApplicationRecord
reload
self.skip_sync = true
update(post_ids: post_ids - [post.id])
self.skip_sync = false
post.remove_pool!(self)
post.save
end

View File

@ -270,8 +270,8 @@ class PoolTest < ActiveSupport::TestCase
assert_equal(true, @pool.valid?)
assert_equal("collection", @pool.category)
assert_equal("pool:#{@pool.id} pool:collection", @p1.reload.pool_string)
assert_equal("pool:#{@pool.id} pool:collection", @p2.reload.pool_string)
assert_equal("pool:#{@pool.id}", @p1.reload.pool_string)
assert_equal("pool:#{@pool.id}", @p2.reload.pool_string)
end
end