tests: add more wiki pages controller tests.
This commit is contained in:
@@ -40,6 +40,16 @@ class WikiPagesControllerTest < ActionController::TestCase
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
should "render for a title" do
|
||||
get :show, {:id => @wiki_page.title}
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
should "redirect for a nonexistent title" do
|
||||
get :show, {:id => "what"}
|
||||
assert_redirected_to(show_or_new_wiki_pages_path(title: "what"))
|
||||
end
|
||||
|
||||
should "render for a negated tag" do
|
||||
@wiki_page.update_attribute(:title, "-aaa")
|
||||
get :show, {:id => @wiki_page.id}
|
||||
@@ -47,6 +57,38 @@ class WikiPagesControllerTest < ActionController::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
context "show_or_new action" do
|
||||
setup do
|
||||
@wiki_page = FactoryGirl.create(:wiki_page)
|
||||
end
|
||||
|
||||
should "redirect when given a title" do
|
||||
get :show_or_new, { title: @wiki_page.title }
|
||||
assert_redirected_to(@wiki_page)
|
||||
end
|
||||
|
||||
should "render when given a nonexistent title" do
|
||||
get :show_or_new, { title: "what" }
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
context "new action" do
|
||||
should "render" do
|
||||
get :new, {}, { user_id: @mod.id }
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
context "edit action" do
|
||||
should "render" do
|
||||
wiki_page = FactoryGirl.create(:wiki_page)
|
||||
|
||||
get :edit, { id: wiki_page.id }, { user_id: @mod.id }
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
context "create action" do
|
||||
should "create a wiki_page" do
|
||||
assert_difference("WikiPage.count", 1) do
|
||||
|
||||
Reference in New Issue
Block a user