summaryrefslogtreecommitdiff
path: root/spec/views/projects/commit/_commit_box.html.haml_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/views/projects/commit/_commit_box.html.haml_spec.rb')
-rw-r--r--spec/views/projects/commit/_commit_box.html.haml_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/views/projects/commit/_commit_box.html.haml_spec.rb b/spec/views/projects/commit/_commit_box.html.haml_spec.rb
index 9c97696493e..9d18519ade6 100644
--- a/spec/views/projects/commit/_commit_box.html.haml_spec.rb
+++ b/spec/views/projects/commit/_commit_box.html.haml_spec.rb
@@ -21,12 +21,37 @@ RSpec.describe 'projects/commit/_commit_box.html.haml' do
end
context 'when there is a pipeline present' do
+ context 'when pipeline has stages' do
+ before do
+ pipeline = create(:ci_pipeline, project: project, sha: project.commit.id, status: 'success')
+ create(:ci_build, pipeline: pipeline, stage: 'build')
+
+ assign(:last_pipeline, project.commit.last_pipeline)
+ end
+
+ it 'shows pipeline stages in vue' do
+ render
+
+ expect(rendered).to have_selector('.js-commit-pipeline-mini-graph')
+ end
+
+ it 'shows pipeline stages in haml when feature flag is disabled' do
+ stub_feature_flags(ci_commit_pipeline_mini_graph_vue: false)
+
+ render
+
+ expect(rendered).to have_selector('.js-commit-pipeline-graph')
+ end
+ end
+
context 'when there are multiple pipelines for a commit' do
it 'shows the last pipeline' do
create(:ci_pipeline, project: project, sha: project.commit.id, status: 'success')
create(:ci_pipeline, project: project, sha: project.commit.id, status: 'canceled')
third_pipeline = create(:ci_pipeline, project: project, sha: project.commit.id, status: 'failed')
+ assign(:last_pipeline, third_pipeline)
+
render
expect(rendered).to have_text("Pipeline ##{third_pipeline.id} failed")
@@ -40,6 +65,8 @@ RSpec.describe 'projects/commit/_commit_box.html.haml' do
end
it 'shows correct pipeline description' do
+ assign(:last_pipeline, pipeline)
+
render
expect(rendered).to have_text "Pipeline ##{pipeline.id} " \