fix pool controller tests
This commit is contained in:
@@ -16,10 +16,16 @@ class PoolVersionsControllerTest < ActionController::TestCase
|
||||
context "index action" do
|
||||
setup do
|
||||
@pool = Factory.create(:pool)
|
||||
CurrentUser.id = 20
|
||||
@pool.versions.create(:post_ids => "1 2")
|
||||
CurrentUser.id = 30
|
||||
@pool.versions.create(:post_ids => "1 2 3 4")
|
||||
@user_2 = Factory.create(:user)
|
||||
@user_3 = Factory.create(:user)
|
||||
|
||||
CurrentUser.scoped(@user_2, "1.2.3.4") do
|
||||
@pool.update_attributes(:post_ids => "1 2")
|
||||
end
|
||||
|
||||
CurrentUser.scoped(@user_3, "5.6.7.8") do
|
||||
@pool.update_attributes(:post_ids => "1 2 3 4")
|
||||
end
|
||||
end
|
||||
|
||||
should "list all versions" do
|
||||
@@ -30,7 +36,7 @@ class PoolVersionsControllerTest < ActionController::TestCase
|
||||
end
|
||||
|
||||
should "list all versions that match the search criteria" do
|
||||
get :index, {:search => {:updater_id_equals => "20"}}
|
||||
get :index, {:search => {:updater_id_equals => @user_2.id}}
|
||||
assert_response :success
|
||||
assert_not_nil(assigns(:pool_versions))
|
||||
assert_equal(1, assigns(:pool_versions).size)
|
||||
|
||||
Reference in New Issue
Block a user