fixes #2885: "Is Deleted" not being recorded correctly for Wiki Page Versions
This commit is contained in:
@@ -61,7 +61,7 @@ class WikiPagesController < ApplicationController
|
|||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@wiki_page = WikiPage.find(params[:id])
|
@wiki_page = WikiPage.find(params[:id])
|
||||||
@wiki_page.update_attribute(:is_deleted, true)
|
@wiki_page.update_attributes(:is_deleted => true)
|
||||||
respond_with(@wiki_page)
|
respond_with(@wiki_page)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -112,13 +112,24 @@ class WikiPagesControllerTest < ActionController::TestCase
|
|||||||
context "destroy action" do
|
context "destroy action" do
|
||||||
setup do
|
setup do
|
||||||
@wiki_page = FactoryGirl.create(:wiki_page)
|
@wiki_page = FactoryGirl.create(:wiki_page)
|
||||||
|
@mod = FactoryGirl.create(:mod_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "destroy a wiki_page" do
|
should "destroy a wiki_page" do
|
||||||
post :destroy, {:id => @wiki_page.id}, {:user_id => @mod.id}
|
CurrentUser.scoped(@mod) do
|
||||||
|
post :destroy, {:id => @wiki_page.id}, {:user_id => @mod.id}
|
||||||
|
end
|
||||||
@wiki_page.reload
|
@wiki_page.reload
|
||||||
assert_equal(true, @wiki_page.is_deleted?)
|
assert_equal(true, @wiki_page.is_deleted?)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "record the deleter" do
|
||||||
|
CurrentUser.scoped(@mod) do
|
||||||
|
post :destroy, {:id => @wiki_page.id}, {:user_id => @mod.id}
|
||||||
|
end
|
||||||
|
@wiki_page.reload
|
||||||
|
assert_equal(@mod.id, @wiki_page.updater_id)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "revert action" do
|
context "revert action" do
|
||||||
|
|||||||
Reference in New Issue
Block a user