From 2c268a9f8c35074ee915d77fa6d313adf9268ed6 Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Tue, 31 Mar 2020 11:56:42 +0200 Subject: [PATCH] Add regression test against #1530 --- test/test_app.rb | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/test/test_app.rb b/test/test_app.rb index 39fa9860..0d4c2556 100644 --- a/test/test_app.rb +++ b/test/test_app.rb @@ -478,15 +478,6 @@ EOF assert last_response.ok? assert last_response.body.include?('Samewise Gamgee') end - - test "previews content on the first page of an empty wiki" do - @path = cloned_testpath("examples/empty.git") - @wiki = Gollum::Wiki.new(@path) - Precious::App.set(:gollum_path, @path) - Precious::App.set(:wiki_options, {}) - post "/gollum/preview", :content => 'abc', :format => 'markdown' - assert last_response.ok? - end test 'throws an error when comparing two identical revisions for a page' do get '/gollum/compare/A.md/fc66539528eb96f21b2bbdbf557788fe8a1196ac...fc66539528eb96f21b2bbdbf557788fe8a1196ac' @@ -898,3 +889,35 @@ context "Frontend with page-file-dir" do Precious::App end end + +context "Frontend with empty repo" do + include Rack::Test::Methods + + setup do + @path = cloned_testpath("examples/empty.git") + @wiki = Gollum::Wiki.new(@path) + Precious::App.set(:gollum_path, @path) + Precious::App.set(:wiki_options, {allow_editing: true}) + end + + teardown do + FileUtils.rm_rf(@path) + end + + def app + Precious::App + end + + test 'previews content on the first page of an empty wiki' do + post '/gollum/preview', :content => 'abc', :format => 'markdown' + assert last_response.ok? + end + + test 'wiki redirects to create page with newly initialized repo' do + get '/Home' + follow_redirect! + assert_equal '/gollum/create/Home', last_request.fullpath + assert last_response.ok? + end + +end \ No newline at end of file