pools: store post_ids as array instead of string (fix #3979)

This commit is contained in:
evazion
2018-11-08 11:32:58 -06:00
parent 8515bf43b4
commit 115ed16a96
14 changed files with 92 additions and 113 deletions

View File

@@ -21,14 +21,14 @@ class PoolElementsControllerTest < ActionDispatch::IntegrationTest
should "add a post to a pool" do
post_auth pool_element_path, @user, params: {:pool_id => @pool.id, :post_id => @post.id, :format => "json"}
@pool.reload
assert_equal([@post.id], @pool.post_id_array)
assert_equal([@post.id], @pool.post_ids)
end
should "add a post to a pool once and only once" do
as_user { @pool.add!(@post) }
post_auth pool_element_path, @user, params: {:pool_id => @pool.id, :post_id => @post.id, :format => "json"}
@pool.reload
assert_equal([@post.id], @pool.post_id_array)
assert_equal([@post.id], @pool.post_ids)
end
end
@@ -40,7 +40,7 @@ class PoolElementsControllerTest < ActionDispatch::IntegrationTest
should "remove a post from a pool" do
delete_auth pool_element_path, @user, params: {:pool_id => @pool.id, :post_id => @post.id, :format => "json"}
@pool.reload
assert_equal([], @pool.post_id_array)
assert_equal([], @pool.post_ids)
end
should "do nothing if the post is not a member of the pool" do
@@ -50,7 +50,7 @@ class PoolElementsControllerTest < ActionDispatch::IntegrationTest
end
delete_auth pool_element_path, @user, params: {:pool_id => @pool.id, :post_id => @post.id, :format => "json"}
@pool.reload
assert_equal([], @pool.post_id_array)
assert_equal([], @pool.post_ids)
end
end
end