forked from e621ng/e621ng
[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:
parent
dbb5870d93
commit
2f416b51b4
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user