tests: add more wiki page versions controller tests.

This commit is contained in:
evazion
2017-02-06 02:17:37 -06:00
parent 43591e0c2d
commit 2d62fff89b

View File

@@ -6,6 +6,10 @@ class WikiPageVersionsControllerTest < ActionController::TestCase
@user = FactoryGirl.create(:user)
CurrentUser.user = @user
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
teardown do
@@ -14,12 +18,6 @@ class WikiPageVersionsControllerTest < ActionController::TestCase
end
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
get :index
assert_response :success
@@ -32,5 +30,19 @@ class WikiPageVersionsControllerTest < ActionController::TestCase
assert_not_nil(assigns(:wiki_page_versions))
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