Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/helpers/ci/status_helper_spec.rb')
-rw-r--r--spec/helpers/ci/status_helper_spec.rb46
1 files changed, 41 insertions, 5 deletions
diff --git a/spec/helpers/ci/status_helper_spec.rb b/spec/helpers/ci/status_helper_spec.rb
index 66c821df8f1..17fe474b360 100644
--- a/spec/helpers/ci/status_helper_spec.rb
+++ b/spec/helpers/ci/status_helper_spec.rb
@@ -55,10 +55,6 @@ RSpec.describe Ci::StatusHelper do
is_expected.to include("href=\"/commit-path\"")
end
- it "does not contain a span element" do
- is_expected.not_to include("<span")
- end
-
it "has 'Pipeline' as the status type in the title" do
is_expected.to include("title=\"Pipeline: passed\"")
end
@@ -88,7 +84,8 @@ RSpec.describe Ci::StatusHelper do
subject { helper.render_status_with_link("success", cssclass: "extra-class") }
it "has appended extra class to icon classes" do
- is_expected.to include("class=\"ci-status-link ci-status-icon-success d-inline-flex extra-class\"")
+ is_expected.to include('class="ci-status-link ci-status-icon-success d-inline-flex ' \
+ 'gl-line-height-1 extra-class"')
end
end
@@ -107,5 +104,44 @@ RSpec.describe Ci::StatusHelper do
is_expected.to include("<svg class=\"s24\"")
end
end
+
+ context "when status is success-with-warnings" do
+ subject { helper.render_status_with_link("success-with-warnings") }
+
+ it "renders warning variant of gl-badge" do
+ is_expected.to include('gl-badge badge badge-pill badge-warning')
+ end
+ end
+
+ context "when status is manual" do
+ subject { helper.render_status_with_link("manual") }
+
+ it "renders neutral variant of gl-badge" do
+ is_expected.to include('gl-badge badge badge-pill badge-neutral')
+ end
+ end
+ end
+
+ describe '#badge_variant' do
+ using RSpec::Parameterized::TableSyntax
+
+ where(:status, :expected_badge_variant_class) do
+ 'success' | 'badge-success'
+ 'success-with-warnings' | 'badge-warning'
+ 'pending' | 'badge-warning'
+ 'failed' | 'badge-danger'
+ 'running' | 'badge-info'
+ 'canceled' | 'badge-neutral'
+ 'manual' | 'badge-neutral'
+ 'other-status' | 'badge-muted'
+ end
+
+ with_them do
+ subject { helper.render_status_with_link(status) }
+
+ it 'uses the correct badge variant classes for gl-badge' do
+ is_expected.to include("gl-badge badge badge-pill #{expected_badge_variant_class}")
+ end
+ end
end
end