Commit 6c80b597 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Introduce path_from_ref and save some typing

parent bb5f0671
...@@ -50,12 +50,12 @@ describe Projects::ArtifactsController do ...@@ -50,12 +50,12 @@ describe Projects::ArtifactsController do
end end
context '302' do context '302' do
def path_from_sha def path_from_ref(ref = pipeline.sha, build_name = build.name)
search_namespace_project_artifacts_path( search_namespace_project_artifacts_path(
project.namespace, project.namespace,
project, project,
pipeline.sha, ref,
build.name, build_name,
'browse') 'browse')
end end
...@@ -72,7 +72,7 @@ describe Projects::ArtifactsController do ...@@ -72,7 +72,7 @@ describe Projects::ArtifactsController do
context 'with sha' do context 'with sha' do
before do before do
get path_from_sha get path_from_ref
end end
it_behaves_like 'redirect to the build' it_behaves_like 'redirect to the build'
...@@ -84,12 +84,7 @@ describe Projects::ArtifactsController do ...@@ -84,12 +84,7 @@ describe Projects::ArtifactsController do
end end
before do before do
get search_namespace_project_artifacts_path( get path_from_ref('master')
project.namespace,
project,
'master',
build.name,
'browse')
end end
it_behaves_like 'redirect to the build' it_behaves_like 'redirect to the build'
...@@ -101,12 +96,7 @@ describe Projects::ArtifactsController do ...@@ -101,12 +96,7 @@ describe Projects::ArtifactsController do
end end
before do before do
get search_namespace_project_artifacts_path( get path_from_ref('improve/awesome')
project.namespace,
project,
'improve/awesome',
build.name,
'browse')
end end
it_behaves_like 'redirect to the build' it_behaves_like 'redirect to the build'
...@@ -120,7 +110,7 @@ describe Projects::ArtifactsController do ...@@ -120,7 +110,7 @@ describe Projects::ArtifactsController do
end end
before do before do
get path_from_sha get path_from_ref
end end
it_behaves_like 'redirect to the build' it_behaves_like 'redirect to the build'
...@@ -133,7 +123,7 @@ describe Projects::ArtifactsController do ...@@ -133,7 +123,7 @@ describe Projects::ArtifactsController do
end end
before do before do
get path_from_sha get path_from_ref
end end
it_behaves_like 'redirect to the build' it_behaves_like 'redirect to the build'
......
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