improved pool interface
This commit is contained in:
@@ -17,14 +17,14 @@ class PoolsPostsControllerTest < ActionController::TestCase
|
||||
|
||||
context "create action" do
|
||||
should "add a post to a pool" do
|
||||
post :create, {:pool_id => @pool.id, :id => @post.id, :format => "json"}, {:user_id => @user.id}
|
||||
post :create, {:pool_id => @pool.id, :post_id => @post.id, :format => "json"}, {:user_id => @user.id}
|
||||
@pool.reload
|
||||
assert_equal([@post.id], @pool.post_id_array)
|
||||
end
|
||||
|
||||
should "add a post to a pool once and only once" do
|
||||
@pool.add_post!(@post)
|
||||
post :create, {:pool_id => @pool.id, :id => @post.id, :format => "json"}, {:user_id => @user.id}
|
||||
post :create, {:pool_id => @pool.id, :post_id => @post.id, :format => "json"}, {:user_id => @user.id}
|
||||
@pool.reload
|
||||
assert_equal([@post.id], @pool.post_id_array)
|
||||
end
|
||||
@@ -36,14 +36,14 @@ class PoolsPostsControllerTest < ActionController::TestCase
|
||||
end
|
||||
|
||||
should "remove a post from a pool" do
|
||||
post :destroy, {:pool_id => @pool.id, :id => @post.id, :format => "json"}, {:user_id => @user.id}
|
||||
post :destroy, {:pool_id => @pool.id, :post_id => @post.id, :format => "json"}, {:user_id => @user.id}
|
||||
@pool.reload
|
||||
assert_equal([], @pool.post_id_array)
|
||||
end
|
||||
|
||||
should "do nothing if the post is not a member of the pool" do
|
||||
@pool.remove_post!(@post)
|
||||
post :destroy, {:pool_id => @pool.id, :id => @post.id, :format => "json"}, {:user_id => @user.id}
|
||||
post :destroy, {:pool_id => @pool.id, :post_id => @post.id, :format => "json"}, {:user_id => @user.id}
|
||||
@pool.reload
|
||||
assert_equal([], @pool.post_id_array)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user