summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2016-02-24 19:10:50 -0500
committerAlfredo Sumaran <alfredo@gitlab.com>2016-02-24 19:10:50 -0500
commitb2dcfc4db3828888f9aa0a9cc38e89fe84d30b2c (patch)
tree82c57e0744f87e51c5ea4875105445419b0781cc
parentb9156669fef4fd96862a5caf720e4820c43325ab (diff)
parentb95ef77e233eab3b3d37a4a7dce545d9da36f8a0 (diff)
downloadgitlab-ce-b2dcfc4db3828888f9aa0a9cc38e89fe84d30b2c.tar.gz
Merge branch 'rs-crowd-form-view-spec' into avatar-cropping
-rw-r--r--.gitlab-ci.yml41
-rw-r--r--app/helpers/auth_helper.rb4
-rw-r--r--app/views/devise/sessions/new.html.haml4
-rw-r--r--app/views/projects/issues/_discussion.html.haml4
-rw-r--r--app/views/projects/issues/show.html.haml8
-rw-r--r--features/login_form.feature11
-rw-r--r--features/steps/login_form.rb25
-rwxr-xr-xscripts/notify_slack.sh13
-rw-r--r--spec/views/devise/shared/_signin_box.html.haml_spec.rb37
9 files changed, 103 insertions, 44 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8a729f957a2..498c7447ede 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -24,7 +24,12 @@ before_script:
- bundle install --without postgres production --jobs $(nproc) "${FLAGS[@]}"
- RAILS_ENV=test bundle exec rake db:drop db:create db:schema:load db:migrate
+stages:
+- test
+- notifications
+
spec:feature:
+ stage: test
script:
- RAILS_ENV=test bundle exec rake assets:precompile 2>/dev/null
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:feature
@@ -33,6 +38,7 @@ spec:feature:
- mysql
spec:api:
+ stage: test
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:api
tags:
@@ -40,6 +46,7 @@ spec:api:
- mysql
spec:models:
+ stage: test
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:models
tags:
@@ -47,6 +54,7 @@ spec:models:
- mysql
spec:lib:
+ stage: test
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:lib
tags:
@@ -54,6 +62,7 @@ spec:lib:
- mysql
spec:services:
+ stage: test
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:services
tags:
@@ -61,6 +70,7 @@ spec:services:
- mysql
spec:benchmark:
+ stage: test
script:
- RAILS_ENV=test bundle exec rake spec:benchmark
tags:
@@ -69,6 +79,7 @@ spec:benchmark:
allow_failure: true
spec:other:
+ stage: test
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:other
tags:
@@ -76,6 +87,7 @@ spec:other:
- mysql
spinach:project:half:
+ stage: test
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:project:half
tags:
@@ -83,6 +95,7 @@ spinach:project:half:
- mysql
spinach:project:rest:
+ stage: test
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:project:rest
tags:
@@ -90,6 +103,7 @@ spinach:project:rest:
- mysql
spinach:other:
+ stage: test
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:other
tags:
@@ -97,6 +111,7 @@ spinach:other:
- mysql
teaspoon:
+ stage: test
script:
- RAILS_ENV=test bundle exec teaspoon
tags:
@@ -104,6 +119,7 @@ teaspoon:
- mysql
rubocop:
+ stage: test
script:
- bundle exec rubocop
tags:
@@ -111,6 +127,7 @@ rubocop:
- mysql
brakeman:
+ stage: test
script:
- bundle exec rake brakeman
tags:
@@ -118,6 +135,7 @@ brakeman:
- mysql
flog:
+ stage: test
script:
- bundle exec rake flog
tags:
@@ -125,6 +143,7 @@ flog:
- mysql
flay:
+ stage: test
script:
- bundle exec rake flay
tags:
@@ -132,6 +151,7 @@ flay:
- mysql
bundler:audit:
+ stage: test
script:
- "bundle exec bundle-audit update"
- "bundle exec bundle-audit check"
@@ -143,6 +163,7 @@ bundler:audit:
# Ruby 2.2 jobs
spec:feature:ruby22:
+ stage: test
image: ruby:2.2
only:
- master
@@ -158,6 +179,7 @@ spec:feature:ruby22:
- mysql
spec:api:ruby22:
+ stage: test
image: ruby:2.2
only:
- master
@@ -172,6 +194,7 @@ spec:api:ruby22:
- mysql
spec:models:ruby22:
+ stage: test
image: ruby:2.2
only:
- master
@@ -186,6 +209,7 @@ spec:models:ruby22:
- mysql
spec:lib:ruby22:
+ stage: test
image: ruby:2.2
only:
- master
@@ -200,6 +224,7 @@ spec:lib:ruby22:
- mysql
spec:services:ruby22:
+ stage: test
image: ruby:2.2
only:
- master
@@ -214,6 +239,7 @@ spec:services:ruby22:
- mysql
spec:benchmark:ruby22:
+ stage: test
image: ruby:2.2
only:
- master
@@ -229,6 +255,7 @@ spec:benchmark:ruby22:
allow_failure: true
spec:other:ruby22:
+ stage: test
image: ruby:2.2
only:
- master
@@ -243,6 +270,7 @@ spec:other:ruby22:
- mysql
spinach:project:half:ruby22:
+ stage: test
image: ruby:2.2
only:
- master
@@ -257,6 +285,7 @@ spinach:project:half:ruby22:
- mysql
spinach:project:rest:ruby22:
+ stage: test
image: ruby:2.2
only:
- master
@@ -271,6 +300,7 @@ spinach:project:rest:ruby22:
- mysql
spinach:other:ruby22:
+ stage: test
image: ruby:2.2
only:
- master
@@ -284,3 +314,14 @@ spinach:other:ruby22:
- ruby
- mysql
+
+notify:slack:
+ stage: notifications
+ script:
+ - ./scripts/notify_slack.sh "#builds" "Build failed for master/tags!"
+ when: on_failure
+ only:
+ - master@gitlab-org/gitlab-ce
+ - tags@gitlab-org/gitlab-ce
+ - master@gitlab-org/gitlab-ee
+ - tags@gitlab-org/gitlab-ee \ No newline at end of file
diff --git a/app/helpers/auth_helper.rb b/app/helpers/auth_helper.rb
index de669e529a7..b4f80fd9b3e 100644
--- a/app/helpers/auth_helper.rb
+++ b/app/helpers/auth_helper.rb
@@ -6,6 +6,10 @@ module AuthHelper
Gitlab.config.ldap.enabled
end
+ def omniauth_enabled?
+ Gitlab.config.omniauth.enabled
+ end
+
def provider_has_icon?(name)
PROVIDERS_WITH_ICONS.include?(name.to_s)
end
diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml
index 1136afbf29c..d65fa60025c 100644
--- a/app/views/devise/sessions/new.html.haml
+++ b/app/views/devise/sessions/new.html.haml
@@ -4,7 +4,7 @@
= render 'devise/shared/signin_box'
-# Omniauth fits between signin/ldap signin and signup and does not have a surrounding box
- - if Gitlab.config.omniauth.enabled && devise_mapping.omniauthable?
+ - if omniauth_enabled? && devise_mapping.omniauthable?
.clearfix.prepend-top-20
= render 'devise/shared/omniauth_box'
@@ -14,6 +14,6 @@
= render 'devise/shared/signup_box'
-# Show a message if none of the mechanisms above are enabled
- - if !signin_enabled? && !ldap_enabled? && !(Gitlab.config.omniauth.enabled && devise_mapping.omniauthable?)
+ - if !signin_enabled? && !ldap_enabled? && !(omniauth_enabled? && devise_mapping.omniauthable?)
%div
No authentication methods configured.
diff --git a/app/views/projects/issues/_discussion.html.haml b/app/views/projects/issues/_discussion.html.haml
index 673020a4e30..eb9c225df2f 100644
--- a/app/views/projects/issues/_discussion.html.haml
+++ b/app/views/projects/issues/_discussion.html.haml
@@ -1,7 +1,7 @@
- content_for :note_actions do
- if can?(current_user, :update_issue, @issue)
- = link_to 'Reopen Issue', issue_path(@issue, issue: {state_event: :reopen}, status_only: true, format: 'json'), data: {no_turbolink: true}, class: "btn btn-nr btn-grouped btn-reopen btn-comment js-note-target-reopen #{issue_button_visibility(@issue, false)}", title: 'Reopen Issue'
- = link_to 'Close Issue', issue_path(@issue, issue: {state_event: :close}, status_only: true, format: 'json'), data: {no_turbolink: true}, class: "btn btn-nr btn-grouped btn-close btn-comment js-note-target-close #{issue_button_visibility(@issue, true)}", title: 'Close Issue'
+ = link_to 'Reopen issue', issue_path(@issue, issue: {state_event: :reopen}, status_only: true, format: 'json'), data: {no_turbolink: true}, class: "btn btn-nr btn-grouped btn-reopen btn-comment js-note-target-reopen #{issue_button_visibility(@issue, false)}", title: 'Reopen issue'
+ = link_to 'Close issue', issue_path(@issue, issue: {state_event: :close}, status_only: true, format: 'json'), data: {no_turbolink: true}, class: "btn btn-nr btn-grouped btn-close btn-comment js-note-target-close #{issue_button_visibility(@issue, true)}", title: 'Close issue'
#notes
= render 'projects/notes/notes_with_form'
diff --git a/app/views/projects/issues/show.html.haml b/app/views/projects/issues/show.html.haml
index 69a0e2a0c4d..1173e0a78c7 100644
--- a/app/views/projects/issues/show.html.haml
+++ b/app/views/projects/issues/show.html.haml
@@ -8,12 +8,12 @@
.detail-page-header
.pull-right
- if can?(current_user, :create_issue, @project)
- = link_to new_namespace_project_issue_path(@project.namespace, @project), class: 'btn btn-nr btn-grouped new-issue-link btn-success', title: 'New Issue', id: 'new_issue_link' do
+ = link_to new_namespace_project_issue_path(@project.namespace, @project), class: 'btn btn-nr btn-grouped new-issue-link btn-success', title: 'New issue', id: 'new_issue_link' do
= icon('plus')
- New Issue
+ New issue
- if can?(current_user, :update_issue, @issue)
- = link_to 'Reopen', issue_path(@issue, issue: {state_event: :reopen}, status_only: true, format: 'json'), data: {no_turbolink: true}, class: "btn btn-nr btn-grouped btn-reopen #{issue_button_visibility(@issue, false)}", title: 'Reopen Issue'
- = link_to 'Close', issue_path(@issue, issue: {state_event: :close}, status_only: true, format: 'json'), data: {no_turbolink: true}, class: "btn btn-nr btn-grouped btn-close #{issue_button_visibility(@issue, true)}", title: 'Close Issue'
+ = link_to 'Reopen issue', issue_path(@issue, issue: {state_event: :reopen}, status_only: true, format: 'json'), data: {no_turbolink: true}, class: "btn btn-nr btn-grouped btn-reopen #{issue_button_visibility(@issue, false)}", title: 'Reopen issue'
+ = link_to 'Close issue', issue_path(@issue, issue: {state_event: :close}, status_only: true, format: 'json'), data: {no_turbolink: true}, class: "btn btn-nr btn-grouped btn-close #{issue_button_visibility(@issue, true)}", title: 'Close issue'
= link_to edit_namespace_project_issue_path(@project.namespace, @project, @issue), class: 'btn btn-nr btn-grouped issuable-edit' do
= icon('pencil-square-o')
diff --git a/features/login_form.feature b/features/login_form.feature
deleted file mode 100644
index 7965882f7fc..00000000000
--- a/features/login_form.feature
+++ /dev/null
@@ -1,11 +0,0 @@
-Feature: Login form
- Scenario: I see Crowd form
- Given Crowd integration enabled
- When I visit sign in page
- Then I should see Crowd login form
-
- Scenario: I see Crowd form when sign-in is disabled
- Given Crowd integration enabled
- And Sign-in is disabled
- When I visit sign in page
- Then I should see Crowd login form
diff --git a/features/steps/login_form.rb b/features/steps/login_form.rb
deleted file mode 100644
index 90ab10e6229..00000000000
--- a/features/steps/login_form.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-class Spinach::Features::LoginForm < Spinach::FeatureSteps
- include SharedAuthentication
- include SharedPaths
- include SharedSnippet
- include SharedUser
- include SharedSearch
-
- step 'Sign-in is disabled' do
- allow_any_instance_of(ApplicationHelper).to receive(:signin_enabled?).and_return(false)
- end
-
- step 'Crowd integration enabled' do
- expect(Gitlab::OAuth::Provider).to receive(:providers).and_return([:crowd])
- expect(Gitlab.config.omniauth).to receive(:enabled).and_return(true)
- allow_any_instance_of(ApplicationHelper).to receive(:user_omniauth_authorize_path).and_return(root_path)
- end
-
- step 'I should see Crowd login form' do
- expect(page).to have_selector '#tab-crowd form'
- end
-
- step 'I visit sign in page' do
- visit new_user_session_path
- end
-end
diff --git a/scripts/notify_slack.sh b/scripts/notify_slack.sh
new file mode 100755
index 00000000000..0a4239e132c
--- /dev/null
+++ b/scripts/notify_slack.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+# Sends Slack notification ERROR_MSG to CHANNEL
+# An env. variable CI_SLACK_WEBHOOK_URL needs to be set.
+
+CHANNEL=$1
+ERROR_MSG=$2
+
+if [ -z "$CHANNEL" ] || [ -z "$ERROR_MSG" ] || [ -z "$CI_SLACK_WEBHOOK_URL" ]; then
+ echo "Missing argument(s) - Use: $0 channel message"
+ echo "and set CI_SLACK_WEBHOOK_URL environment variable."
+else
+ curl -X POST --data-urlencode 'payload={"channel": "'"$CHANNEL"'", "username": "gitlab-ci", "text": "'"$ERROR_MSG"'", "icon_emoji": ":gitlab:"}' "$CI_SLACK_WEBHOOK_URL"
+fi \ No newline at end of file
diff --git a/spec/views/devise/shared/_signin_box.html.haml_spec.rb b/spec/views/devise/shared/_signin_box.html.haml_spec.rb
new file mode 100644
index 00000000000..05a76ee4bdb
--- /dev/null
+++ b/spec/views/devise/shared/_signin_box.html.haml_spec.rb
@@ -0,0 +1,37 @@
+require 'rails_helper'
+
+describe 'devise/shared/_signin_box' do
+ describe 'Crowd form' do
+ before do
+ stub_devise
+ assign(:ldap_servers, [])
+ end
+
+ it 'is shown when Crowd is enabled' do
+ enable_crowd
+
+ render
+
+ expect(rendered).to have_selector('#tab-crowd form')
+ end
+
+ it 'is not shown when Crowd is disabled' do
+ render
+
+ expect(rendered).not_to have_selector('#tab-crowd')
+ end
+ end
+
+ def stub_devise
+ allow(view).to receive(:devise_mapping).and_return(Devise.mappings[:user])
+ allow(view).to receive(:resource).and_return(spy)
+ allow(view).to receive(:resource_name).and_return(:user)
+ end
+
+ def enable_crowd
+ allow(view).to receive(:form_based_providers).and_return([:crowd])
+ allow(view).to receive(:crowd_enabled?).and_return(true)
+ allow(view).to receive(:user_omniauth_authorize_path).with('crowd').
+ and_return('/crowd')
+ end
+end