From 45437811538aac675c15b09445c73e72278ef7c1 Mon Sep 17 00:00:00 2001 From: Arran Cudbard-Bell Date: Sun, 17 Jul 2011 15:44:13 +0200 Subject: [PATCH] Add tests to check page redirects to create --- test/test_app.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/test_app.rb b/test/test_app.rb index 203b964d..5ae94cf7 100644 --- a/test/test_app.rb +++ b/test/test_app.rb @@ -124,6 +124,30 @@ context "Frontend" do assert_match /ghi/, last_response.body end + test "redirects to create on non-existant page" do + name = "E" + get "/#{name}" + follow_redirect! + assert_equal "/create/#{name}", last_request.fullpath + assert last_response.ok? + end + + test "edit redirects to create on non-existant page" do + name = "E" + get "/edit/#{name}" + follow_redirect! + assert_equal "/create/#{name}", last_request.fullpath + assert last_response.ok? + end + + test "create redirects to page if already exists" do + name = "A" + get "/create/#{name}" + follow_redirect! + assert_equal "/#{name}", last_request.fullpath + assert last_response.ok? + end + test "guards against creation of existing page" do name = "A" post "/create", :content => 'abc', :page => name,