summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorFabian Schneider <fabbbbbi+git@googlemail.com>2019-01-18 13:39:35 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2019-01-18 13:39:35 +0000
commitdf1b6340e6672663dca9cc82c442d6da5a2af098 (patch)
tree091143f6a076dfad37359a8036789fe6bd6b494c /spec
parentb479ddc769c2a0c3235cdae7184f1a5a4e9815c7 (diff)
downloadgitlab-ce-df1b6340e6672663dca9cc82c442d6da5a2af098.tar.gz
Add flat-square badge style
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/projects/badges_controller_spec.rb41
1 files changed, 39 insertions, 2 deletions
diff --git a/spec/controllers/projects/badges_controller_spec.rb b/spec/controllers/projects/badges_controller_spec.rb
index 2556bc3ae50..8eac3d9a459 100644
--- a/spec/controllers/projects/badges_controller_spec.rb
+++ b/spec/controllers/projects/badges_controller_spec.rb
@@ -22,7 +22,44 @@ describe Projects::BadgesController do
expect(response).to have_gitlab_http_status(:ok)
end
- def get_badge(badge)
- get badge, params: { namespace_id: project.namespace.to_param, project_id: project, ref: pipeline.ref }, format: :svg
+ it 'renders the `flat` badge layout by default' do
+ get_badge(:coverage)
+
+ expect(response).to render_template('projects/badges/badge')
+ end
+
+ context 'when style param is set to `flat`' do
+ it 'renders the `flat` badge layout' do
+ get_badge(:coverage, 'flat')
+
+ expect(response).to render_template('projects/badges/badge')
+ end
+ end
+
+ context 'when style param is set to an invalid type' do
+ it 'renders the `flat` (default) badge layout' do
+ get_badge(:coverage, 'xxx')
+
+ expect(response).to render_template('projects/badges/badge')
+ end
+ end
+
+ context 'when style param is set to `flat-square`' do
+ it 'renders the `flat-square` badge layout' do
+ get_badge(:coverage, 'flat-square')
+
+ expect(response).to render_template('projects/badges/badge_flat-square')
+ end
+ end
+
+ def get_badge(badge, style = nil)
+ params = {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ ref: pipeline.ref,
+ style: style
+ }
+
+ get badge, params: params, format: :svg
end
end