Commit fc94b3b0 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Fix API archive specs

parent 033a879c
...@@ -166,24 +166,21 @@ describe API::API, api: true do ...@@ -166,24 +166,21 @@ describe API::API, api: true do
get api("/projects/#{project.id}/repository/archive", user) get api("/projects/#{project.id}/repository/archive", user)
repo_name = project.repository.name.gsub("\.git", "") repo_name = project.repository.name.gsub("\.git", "")
expect(response.status).to eq(200) expect(response.status).to eq(200)
expect(response.headers['Content-Disposition']).to match(/filename\=\"#{repo_name}\-[^\.]+\.tar.gz\"/) expect(json_response['ArchivePath']).to match(/#{repo_name}\-[^\.]+\.tar.gz/)
expect(response.content_type).to eq(MIME::Types.type_for('file.tar.gz').first.content_type)
end end
it "should get the archive.zip" do it "should get the archive.zip" do
get api("/projects/#{project.id}/repository/archive.zip", user) get api("/projects/#{project.id}/repository/archive.zip", user)
repo_name = project.repository.name.gsub("\.git", "") repo_name = project.repository.name.gsub("\.git", "")
expect(response.status).to eq(200) expect(response.status).to eq(200)
expect(response.headers['Content-Disposition']).to match(/filename\=\"#{repo_name}\-[^\.]+\.zip\"/) expect(json_response['ArchivePath']).to match(/#{repo_name}\-[^\.]+\.zip/)
expect(response.content_type).to eq(MIME::Types.type_for('file.zip').first.content_type)
end end
it "should get the archive.tar.bz2" do it "should get the archive.tar.bz2" do
get api("/projects/#{project.id}/repository/archive.tar.bz2", user) get api("/projects/#{project.id}/repository/archive.tar.bz2", user)
repo_name = project.repository.name.gsub("\.git", "") repo_name = project.repository.name.gsub("\.git", "")
expect(response.status).to eq(200) expect(response.status).to eq(200)
expect(response.headers['Content-Disposition']).to match(/filename\=\"#{repo_name}\-[^\.]+\.tar.bz2\"/) expect(json_response['ArchivePath']).to match(/#{repo_name}\-[^\.]+\.tar.bz2/)
expect(response.content_type).to eq(MIME::Types.type_for('file.tar.bz2').first.content_type)
end end
it "should return 404 for invalid sha" do it "should return 404 for invalid sha" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment