From d234bbd8613476dc8524a046224266808e041f3b Mon Sep 17 00:00:00 2001 From: bootstraponline Date: Mon, 6 Aug 2012 18:27:12 -0600 Subject: [PATCH] Test `get %r{/(.+?)/([0-9a-f]{40})} do` --- test/test_app.rb | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/test/test_app.rb b/test/test_app.rb index ddf257ed..dc273926 100644 --- a/test/test_app.rb +++ b/test/test_app.rb @@ -142,13 +142,14 @@ context "Frontend" do assert last_response.ok? end - test "page create and edit with dash" do + test "page create and edit with dash & page rev" do page = 'c-d-e' path = 'a/b/' # path must end with / post '/create', :content => 'create_msg', :page => page, :path => path, :format => 'markdown', :message => '' - assert_equal 'create_msg', @wiki.paged(page, path).raw_data + page_c = @wiki.paged(page, path) + assert_equal 'create_msg', page_c.raw_data # must clear or create_msg will be returned @wiki.clear_cache @@ -156,7 +157,19 @@ context "Frontend" do # post '/edit' fails. post '/edit/' works. post '/edit/', :content => 'edit_msg', :page => page, :path => path, :message => '' - assert_equal 'edit_msg', @wiki.paged(page, path).raw_data + page_e = @wiki.paged(page, path) + assert_equal 'edit_msg', page_e.raw_data + + @wiki.clear_cache + + # test `get %r{/(.+?)/([0-9a-f]{40})} do` in app.rb + get '/' + page_c.escaped_url_path + '/' + page_c.version.to_s + assert last_response.ok? + assert_match /create_msg/, last_response.body + + get '/' + page_e.escaped_url_path + '/' + page_e.version.to_s + assert last_response.ok? + assert_match /edit_msg/, last_response.body end test "guards against creation of existing page" do