tests: add more wiki page versions controller tests.
This commit is contained in:
@@ -6,6 +6,10 @@ class WikiPageVersionsControllerTest < ActionController::TestCase
|
|||||||
@user = FactoryGirl.create(:user)
|
@user = FactoryGirl.create(:user)
|
||||||
CurrentUser.user = @user
|
CurrentUser.user = @user
|
||||||
CurrentUser.ip_addr = "127.0.0.1"
|
CurrentUser.ip_addr = "127.0.0.1"
|
||||||
|
|
||||||
|
@wiki_page = FactoryGirl.create(:wiki_page)
|
||||||
|
@wiki_page.update_attributes(:body => "1 2")
|
||||||
|
@wiki_page.update_attributes(:body => "2 3")
|
||||||
end
|
end
|
||||||
|
|
||||||
teardown do
|
teardown do
|
||||||
@@ -14,12 +18,6 @@ class WikiPageVersionsControllerTest < ActionController::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "index action" do
|
context "index action" do
|
||||||
setup do
|
|
||||||
@wiki_page = FactoryGirl.create(:wiki_page)
|
|
||||||
@wiki_page.update_attributes(:body => "1 2")
|
|
||||||
@wiki_page.update_attributes(:body => "2 3")
|
|
||||||
end
|
|
||||||
|
|
||||||
should "list all versions" do
|
should "list all versions" do
|
||||||
get :index
|
get :index
|
||||||
assert_response :success
|
assert_response :success
|
||||||
@@ -32,5 +30,19 @@ class WikiPageVersionsControllerTest < ActionController::TestCase
|
|||||||
assert_not_nil(assigns(:wiki_page_versions))
|
assert_not_nil(assigns(:wiki_page_versions))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "show action" do
|
||||||
|
should "render" do
|
||||||
|
get :show, { id: @wiki_page.versions.first.id }
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "diff action" do
|
||||||
|
should "render" do
|
||||||
|
get :diff, { thispage: @wiki_page.versions.first.id, otherpage: @wiki_page.versions.last.id }
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user