fixed tests

This commit is contained in:
albert
2011-02-02 16:55:36 -05:00
parent 099c75f9b6
commit c80df378d8
14 changed files with 27 additions and 23 deletions

View File

@@ -6,7 +6,8 @@ class PostsControllerTest < ActionController::TestCase
@user = Factory.create(:user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
@post = Factory.create(:post, :uploader_id => @user.id, :tag_string => "aaa")
@post = Factory.create(:post, :uploader_id => @user.id, :tag_string => "aaaa")
MEMCACHE.flush_all
end
teardown do
@@ -22,7 +23,7 @@ class PostsControllerTest < ActionController::TestCase
context "with a search" do
should "render" do
get :index, {:tags => "aaa"}
get :index, {:tags => "aaaa"}
assert_response :success
end
end
@@ -52,11 +53,11 @@ class PostsControllerTest < ActionController::TestCase
should "work" do
@version = @post.versions(true).first
assert_equal("aaa", @version.add_tags)
assert_equal("aaaa", @version.add_tags)
post :revert, {:id => @post.id, :version_id => @version.id}, {:user_id => @user.id}
assert_redirected_to post_path(@post)
@post.reload
assert_equal("aaa", @post.tag_string)
assert_equal("aaaa", @post.tag_string)
end
end
end

View File

@@ -45,7 +45,9 @@ class UnapprovalsControllerTest < ActionController::TestCase
should "create a new unapproval" do
assert_difference("Unapproval.count", 1) do
post :create, {:post_id => @post.id, :reason => "xxx"}, {:user_id => @user.id}
post :create, {:unapproval => {:post_id => @post.id, :reason => "xxx"}}, {:user_id => @user.id}
assert_not_nil(assigns(:unapproval))
assert_equal([], assigns(:unapproval).errors.full_messages)
end
end
end

View File

@@ -80,7 +80,7 @@ class WikiPagesControllerTest < ActionController::TestCase
end
should "revert to a previous version" do
version = @wiki_page.versions(true).last
version = @wiki_page.versions(true).first
assert_equal("1", version.body)
post :revert, {:id => @wiki_page.id, :version_id => version.id}
@wiki_page.reload