Merge pull request #1531 from repotag/check_empty_repo

Add regression test against #1530
This commit is contained in:
Dawa Ometto
2020-03-31 16:51:19 +02:00
committed by GitHub
+32 -9
View File
@@ -478,15 +478,6 @@ EOF
assert last_response.ok?
assert last_response.body.include?('Samewise Gamgee</h1>')
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