diff --git a/test/functional/wiki_pages_controller_test.rb b/test/functional/wiki_pages_controller_test.rb index 53c0e588f..472b4a2c1 100644 --- a/test/functional/wiki_pages_controller_test.rb +++ b/test/functional/wiki_pages_controller_test.rb @@ -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