2016-07-12 15:15:08 +00:00
|
|
|
require 'spec_helper'
|
2016-07-13 15:05:57 +00:00
|
|
|
require_relative '../shared/artifacts_context'
|
2016-07-12 15:15:08 +00:00
|
|
|
|
|
|
|
describe Projects::ArtifactsController do
|
2016-07-13 15:23:05 +00:00
|
|
|
describe 'GET /:project/artifacts/:ref/:build_name/browse' do
|
|
|
|
include_context 'artifacts from ref and build name'
|
2016-07-12 15:15:08 +00:00
|
|
|
|
2016-07-13 15:23:05 +00:00
|
|
|
before do
|
|
|
|
login_as(user)
|
|
|
|
end
|
2016-07-12 15:15:08 +00:00
|
|
|
|
2016-07-13 15:05:57 +00:00
|
|
|
def path_from_ref(ref = pipeline.sha, build_name = build.name,
|
|
|
|
path = 'browse')
|
|
|
|
search_namespace_project_artifacts_path(
|
|
|
|
project.namespace,
|
|
|
|
project,
|
|
|
|
ref,
|
|
|
|
build_name,
|
|
|
|
path)
|
|
|
|
end
|
2016-07-12 15:15:08 +00:00
|
|
|
|
2016-07-13 15:05:57 +00:00
|
|
|
context '404' do
|
|
|
|
def verify
|
2016-07-12 15:15:08 +00:00
|
|
|
expect(response.status).to eq(404)
|
|
|
|
end
|
|
|
|
|
2016-07-13 15:05:57 +00:00
|
|
|
it_behaves_like 'artifacts from ref with 404'
|
2016-07-12 15:15:08 +00:00
|
|
|
|
2016-07-13 15:05:57 +00:00
|
|
|
context 'has no path' do
|
|
|
|
before do
|
|
|
|
get path_from_ref(pipeline.sha, build.name, '')
|
|
|
|
end
|
2016-07-12 15:15:08 +00:00
|
|
|
|
2016-07-13 15:05:57 +00:00
|
|
|
it('gives 404') { verify }
|
2016-07-12 15:15:08 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context '302' do
|
2016-07-13 15:05:57 +00:00
|
|
|
def verify
|
|
|
|
path = browse_namespace_project_build_artifacts_path(
|
2016-07-12 15:15:08 +00:00
|
|
|
project.namespace,
|
|
|
|
project,
|
2016-07-13 15:05:57 +00:00
|
|
|
build)
|
2016-07-12 15:15:08 +00:00
|
|
|
|
2016-07-13 15:05:57 +00:00
|
|
|
expect(response).to redirect_to(path)
|
2016-07-12 15:15:08 +00:00
|
|
|
end
|
|
|
|
|
2016-07-13 15:05:57 +00:00
|
|
|
it_behaves_like 'artifacts from ref with 302'
|
2016-07-12 15:15:08 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|