summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Gemfile10
-rw-r--r--Gemfile.lock245
-rw-r--r--Procfile2
-rw-r--r--app/controllers/abuse_reports_controller.rb2
-rw-r--r--app/mailers/base_mailer.rb4
-rw-r--r--app/models/project_services/ci/mail_service.rb6
-rw-r--r--app/models/project_services/gitlab_ci_service.rb2
-rw-r--r--app/models/sent_notification.rb5
-rw-r--r--app/services/notification_service.rb75
-rw-r--r--app/views/ci/admin/runners/show.html.haml2
-rw-r--r--app/views/ci/notify/build_success_email.html.haml2
-rw-r--r--app/views/projects/edit.html.haml2
-rw-r--r--app/views/projects/runners/edit.html.haml2
-rw-r--r--app/workers/email_receiver_worker.rb2
-rw-r--r--app/workers/emails_on_push_worker.rb2
-rwxr-xr-x[-rw-r--r--]bin/ci/upgrade.rb0
-rwxr-xr-xbin/rails6
-rwxr-xr-xbin/rake9
-rwxr-xr-xbin/setup29
-rwxr-xr-x[-rw-r--r--]bin/upgrade.rb0
-rw-r--r--config/application.rb4
-rw-r--r--config/environment.rb2
-rw-r--r--config/environments/development.rb2
-rw-r--r--config/environments/production.rb4
-rw-r--r--config/environments/test.rb6
-rw-r--r--config/initializers/cookies_serializer.rb2
-rw-r--r--config/initializers/default_url_options.rb2
-rw-r--r--config/initializers/rack_attack.rb.example14
-rw-r--r--config/initializers/rack_lineprof.rb2
-rw-r--r--config/initializers/secret_token.rb8
-rw-r--r--config/initializers/session_store.rb4
-rw-r--r--config/initializers/sherlock.rb2
-rw-r--r--config/initializers/smtp_settings.rb.sample2
-rw-r--r--config/initializers/static_files.rb4
-rw-r--r--config/routes.rb2
-rw-r--r--db/schema.rb106
-rw-r--r--lib/gitlab/github_import/client.rb2
-rw-r--r--lib/gitlab/gitlab_import/client.rb2
-rw-r--r--lib/gitlab/markdown/label_reference_filter.rb3
-rw-r--r--lib/gitlab/seeder.rb2
-rw-r--r--spec/controllers/abuse_reports_controller_spec.rb36
-rw-r--r--spec/features/admin/admin_users_spec.rb7
-rw-r--r--spec/helpers/application_helper_spec.rb2
-rw-r--r--spec/lib/gitlab/markdown/label_reference_filter_spec.rb6
-rw-r--r--spec/models/ci/project_services/mail_service_spec.rb62
-rw-r--r--spec/models/project_services/jira_service_spec.rb6
-rw-r--r--spec/services/issues/close_service_spec.rb4
-rw-r--r--spec/services/issues/update_service_spec.rb5
-rw-r--r--spec/services/merge_requests/close_service_spec.rb4
-rw-r--r--spec/services/merge_requests/merge_service_spec.rb5
-rw-r--r--spec/services/merge_requests/reopen_service_spec.rb4
-rw-r--r--spec/services/merge_requests/update_service_spec.rb6
-rw-r--r--spec/services/notification_service_spec.rb345
-rw-r--r--spec/spec_helper.rb1
-rw-r--r--spec/workers/email_receiver_worker_spec.rb14
55 files changed, 566 insertions, 523 deletions
diff --git a/Gemfile b/Gemfile
index 51ce6c9ed72..67640bb9ae0 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,6 +1,10 @@
source "https://rubygems.org"
-gem 'rails', '4.1.14'
+gem 'rails', '4.2.4'
+gem 'rails-deprecated_sanitizer', '~> 1.0.3'
+
+# Responders respond_to and respond_with
+gem 'responders', '~> 2.0'
# Specify a sprockets version due to security issue
# See https://groups.google.com/forum/#!topic/rubyonrails-security/doAVp0YaTqY
@@ -95,6 +99,7 @@ gem 'org-ruby', '~> 0.9.12'
gem 'creole', '~> 0.5.0'
gem 'wikicloth', '0.8.1'
gem 'asciidoctor', '~> 1.5.2'
+gem 'net-ssh', '~> 3.0.1'
# Diffs
gem 'diffy', '~> 3.0.3'
@@ -210,6 +215,7 @@ group :development do
gem 'rerun', '~> 0.10.0'
gem 'bullet', require: false
gem 'rblineprof', platform: :mri, require: false
+ gem 'web-console', '~> 2.0'
# Better errors handler
gem 'better_errors', '~> 1.0.1'
@@ -266,7 +272,7 @@ group :test do
gem 'shoulda-matchers', '~> 2.8.0', require: false
gem 'email_spec', '~> 1.6.0'
gem 'webmock', '~> 1.21.0'
- gem 'test_after_commit', '~> 0.2.2'
+ gem 'test_after_commit', '~> 0.4.2'
gem 'sham_rack'
end
diff --git a/Gemfile.lock b/Gemfile.lock
index 54a63ea22df..dcb4a74e239 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,62 +1,71 @@
GEM
remote: https://rubygems.org/
specs:
- CFPropertyList (2.3.1)
+ CFPropertyList (2.3.2)
RedCloth (4.2.9)
ace-rails-ap (2.0.1)
- actionmailer (4.1.14)
- actionpack (= 4.1.14)
- actionview (= 4.1.14)
+ actionmailer (4.2.4)
+ actionpack (= 4.2.4)
+ actionview (= 4.2.4)
+ activejob (= 4.2.4)
mail (~> 2.5, >= 2.5.4)
- actionpack (4.1.14)
- actionview (= 4.1.14)
- activesupport (= 4.1.14)
- rack (~> 1.5.2)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ actionpack (4.2.4)
+ actionview (= 4.2.4)
+ activesupport (= 4.2.4)
+ rack (~> 1.6)
rack-test (~> 0.6.2)
- actionview (4.1.14)
- activesupport (= 4.1.14)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ actionview (4.2.4)
+ activesupport (= 4.2.4)
builder (~> 3.1)
erubis (~> 2.7.0)
- activemodel (4.1.14)
- activesupport (= 4.1.14)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ activejob (4.2.4)
+ activesupport (= 4.2.4)
+ globalid (>= 0.3.0)
+ activemodel (4.2.4)
+ activesupport (= 4.2.4)
builder (~> 3.1)
- activerecord (4.1.14)
- activemodel (= 4.1.14)
- activesupport (= 4.1.14)
- arel (~> 5.0.0)
+ activerecord (4.2.4)
+ activemodel (= 4.2.4)
+ activesupport (= 4.2.4)
+ arel (~> 6.0)
activerecord-deprecated_finders (1.0.4)
- activerecord-session_store (0.1.1)
+ activerecord-session_store (0.1.2)
actionpack (>= 4.0.0, < 5)
activerecord (>= 4.0.0, < 5)
railties (>= 4.0.0, < 5)
- activesupport (4.1.14)
- i18n (~> 0.6, >= 0.6.9)
+ activesupport (4.2.4)
+ i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
- thread_safe (~> 0.1)
+ thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
acts-as-taggable-on (3.5.0)
activerecord (>= 3.2, < 5)
addressable (2.3.8)
- after_commit_queue (1.1.0)
- rails (>= 3.0)
+ after_commit_queue (1.3.0)
+ activerecord (>= 3.0)
annotate (2.6.10)
activerecord (>= 3.2, <= 4.3)
rake (~> 10.4)
- arel (5.0.1.20140414130214)
+ arel (6.0.3)
asana (0.4.0)
faraday (~> 0.9)
faraday_middleware (~> 0.9)
faraday_middleware-multi_json (~> 0.0)
oauth2 (~> 1.0)
- asciidoctor (1.5.2)
+ asciidoctor (1.5.3)
ast (2.1.0)
astrolabe (1.3.1)
parser (~> 2.2)
attr_encrypted (1.3.4)
encryptor (>= 1.3.0)
attr_required (1.0.0)
- autoprefixer-rails (5.2.1.2)
+ autoprefixer-rails (6.1.1)
execjs
json
awesome_print (1.2.0)
@@ -84,15 +93,15 @@ GEM
ruby_parser (~> 3.5.0)
sass (~> 3.0)
terminal-table (~> 1.4)
- browser (1.0.0)
+ browser (1.0.1)
builder (3.2.2)
- bullet (4.14.9)
+ bullet (4.14.10)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.9.0)
bundler-audit (0.4.0)
bundler (~> 1.2)
thor (~> 0.18)
- byebug (6.0.2)
+ byebug (8.2.0)
cal-heatmap-rails (0.0.1)
capybara (2.4.4)
mime-types (>= 1.16)
@@ -107,10 +116,25 @@ GEM
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
json (>= 1.7)
- celluloid (0.16.0)
- timers (~> 4.0.0)
+ celluloid (0.17.2)
+ celluloid-essentials
+ celluloid-extras
+ celluloid-fsm
+ celluloid-pool
+ celluloid-supervision
+ timers (>= 4.1.1)
+ celluloid-essentials (0.20.5)
+ timers (>= 4.1.1)
+ celluloid-extras (0.20.5)
+ timers (>= 4.1.1)
+ celluloid-fsm (0.20.5)
+ timers (>= 4.1.1)
+ celluloid-pool (0.20.5)
+ timers (>= 4.1.1)
+ celluloid-supervision (0.20.5)
+ timers (>= 4.1.1)
charlock_holmes (0.7.3)
- chunky_png (1.3.4)
+ chunky_png (1.3.5)
cliver (0.3.2)
coderay (1.1.0)
coercible (1.0.0)
@@ -124,12 +148,13 @@ GEM
coffee-script-source (1.10.0)
colorize (0.7.7)
connection_pool (2.2.0)
- coveralls (0.8.2)
+ coveralls (0.8.9)
json (~> 1.8)
rest-client (>= 1.6.8, < 2)
simplecov (~> 0.10.0)
term-ansicolor (~> 1.3)
thor (~> 0.19.1)
+ tins (~> 1.6.0)
crack (0.4.2)
safe_yaml (~> 1.0.0)
creole (0.5.0)
@@ -152,7 +177,7 @@ GEM
warden (~> 1.2.3)
devise-async (0.9.0)
devise (~> 3.2)
- devise-two-factor (2.0.0)
+ devise-two-factor (2.0.1)
activesupport
attr_encrypted (~> 1.3.2)
devise (~> 3.5.0)
@@ -161,11 +186,11 @@ GEM
diff-lcs (1.2.5)
diffy (3.0.7)
docile (1.1.5)
- domain_name (0.5.24)
+ domain_name (0.5.25)
unf (>= 0.0.5, < 1.0.0)
doorkeeper (2.2.2)
railties (>= 3.2)
- dropzonejs-rails (0.7.1)
+ dropzonejs-rails (0.7.2)
rails (> 3.1)
email_reply_parser (0.5.8)
email_spec (1.6.0)
@@ -202,7 +227,7 @@ GEM
flog (4.3.2)
ruby_parser (~> 3.1, > 3.1.0)
sexp_processor (~> 4.4)
- flowdock (0.7.0)
+ flowdock (0.7.1)
httparty (~> 0.7)
multi_json
fog (1.25.0)
@@ -224,13 +249,10 @@ GEM
fog-core (~> 1.22)
fog-json
inflecto (~> 0.0.2)
- fog-core (1.32.1)
+ fog-core (1.35.0)
builder
excon (~> 0.45)
formatador (~> 0.2)
- mime-types
- net-scp (~> 1.1)
- net-ssh (>= 2.1.3)
fog-json (1.0.2)
fog-core (~> 1.0)
multi_json (~> 1.10)
@@ -242,10 +264,10 @@ GEM
fog-core (>= 1.21.0)
fog-json
fog-xml (>= 0.0.1)
- fog-sakuracloud (1.0.1)
+ fog-sakuracloud (1.4.0)
fog-core
fog-json
- fog-softlayer (0.4.7)
+ fog-softlayer (1.0.2)
fog-core
fog-json
fog-terremark (0.1.0)
@@ -260,7 +282,7 @@ GEM
fog-xml (0.1.2)
fog-core
nokogiri (~> 1.5, >= 1.5.11)
- font-awesome-rails (4.4.0.0)
+ font-awesome-rails (4.5.0.0)
railties (>= 3.2, < 5.0)
foreman (0.78.0)
thor (~> 0.19.1)
@@ -270,11 +292,11 @@ GEM
ruby-progressbar (~> 1.4)
gemnasium-gitlab-service (0.2.6)
rugged (~> 0.21)
- gemojione (2.0.1)
+ gemojione (2.1.0)
json
get_process_mem (0.2.0)
gherkin-ruby (0.3.2)
- github-linguist (4.7.0)
+ github-linguist (4.7.2)
charlock_holmes (~> 0.7.3)
escape_utils (~> 1.1.0)
mime-types (>= 1.19)
@@ -289,8 +311,8 @@ GEM
diff-lcs (~> 1.1)
mime-types (~> 1.15)
posix-spawn (~> 0.3)
- gitlab_emoji (0.1.1)
- gemojione (~> 2.0)
+ gitlab_emoji (0.2.0)
+ gemojione (~> 2.1)
gitlab_git (7.2.20)
activesupport (~> 4.0)
charlock_holmes (~> 0.7.3)
@@ -302,6 +324,8 @@ GEM
omniauth (~> 1.0)
pyu-ruby-sasl (~> 0.0.3.1)
rubyntlm (~> 0.3)
+ globalid (0.3.6)
+ activesupport (>= 4.1.0)
gollum-grit_adapter (1.0.0)
gitlab-grit (~> 2.7, >= 2.7.1)
gollum-lib (4.0.3)
@@ -337,7 +361,7 @@ GEM
haml (>= 4.0.6, < 5.0)
html2haml (>= 1.0.1)
railties (>= 4.0.1)
- hashie (3.4.2)
+ hashie (3.4.3)
highline (1.6.21)
hike (1.2.3)
hipchat (1.5.2)
@@ -355,7 +379,7 @@ GEM
http-cookie (1.0.2)
domain_name (~> 0.5)
http_parser.rb (0.5.3)
- httparty (0.13.5)
+ httparty (0.13.7)
json (~> 1.8)
multi_xml (>= 0.5.2)
httpclient (2.7.0.1)
@@ -365,7 +389,7 @@ GEM
inflecto (0.0.2)
ipaddress (0.8.0)
jquery-atwho-rails (1.3.2)
- jquery-rails (3.1.3)
+ jquery-rails (3.1.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
jquery-scrollto-rails (1.4.3)
@@ -376,19 +400,21 @@ GEM
jquery-ui-rails (4.2.1)
railties (>= 3.2.16)
json (1.8.3)
- jwt (1.5.1)
+ jwt (1.5.2)
kaminari (0.16.3)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
- kgio (2.9.3)
+ kgio (2.10.0)
launchy (2.4.3)
addressable (~> 2.3)
letter_opener (1.1.2)
launchy (~> 2.2)
- listen (2.10.1)
- celluloid (~> 0.16.0)
+ listen (2.9.0)
+ celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
+ loofah (2.0.3)
+ nokogiri (>= 1.5.9)
macaddr (1.7.1)
systemu (~> 2.6.2)
mail (2.6.3)
@@ -405,16 +431,14 @@ GEM
multipart-post (2.0.0)
mysql2 (0.3.20)
nested_form (0.3.2)
- net-ldap (0.11)
- net-scp (1.2.1)
- net-ssh (>= 2.6.5)
- net-ssh (2.9.2)
- netrc (0.10.3)
+ net-ldap (0.12.1)
+ net-ssh (3.0.1)
+ netrc (0.11.0)
newrelic-grape (2.0.0)
grape
newrelic_rpm
newrelic_rpm (3.9.4.245)
- nokogiri (1.6.6.2)
+ nokogiri (1.6.6.4)
mini_portile (~> 0.6.0)
nprogress-rails (0.1.6.7)
oauth (0.4.7)
@@ -438,12 +462,15 @@ GEM
omniauth-github (1.1.2)
omniauth (~> 1.0)
omniauth-oauth2 (~> 1.1)
- omniauth-gitlab (1.0.0)
+ omniauth-gitlab (1.0.1)
omniauth (~> 1.0)
omniauth-oauth2 (~> 1.0)
- omniauth-google-oauth2 (0.2.6)
- omniauth (> 1.0)
- omniauth-oauth2 (~> 1.1)
+ omniauth-google-oauth2 (0.2.10)
+ addressable (~> 2.3)
+ jwt (~> 1.0)
+ multi_json (~> 1.3)
+ omniauth (>= 1.1.1)
+ omniauth-oauth2 (~> 1.3.1)
omniauth-kerberos (0.3.0)
omniauth-multipassword
timfel-krb5-auth (~> 0.8)
@@ -467,18 +494,18 @@ GEM
activesupport
nokogiri (>= 1.4.4)
omniauth (~> 1.0)
- opennebula (4.12.1)
+ opennebula (4.14.2)
json
nokogiri
rbvmomi
org-ruby (0.9.12)
rubypants (~> 0.2)
orm_adapter (0.5.0)
- paranoia (2.1.3)
+ paranoia (2.1.4)
activerecord (~> 4.0)
- parser (2.2.2.6)
+ parser (2.2.3.0)
ast (>= 1.1, < 3.0)
- pg (0.18.2)
+ pg (0.18.4)
poltergeist (1.6.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
@@ -486,7 +513,7 @@ GEM
websocket-driver (>= 0.2.0)
posix-spawn (0.3.11)
powerpack (0.0.9)
- pry (0.10.1)
+ pry (0.10.3)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
@@ -495,7 +522,7 @@ GEM
pyu-ruby-sasl (0.0.3.3)
quiet_assets (1.0.3)
railties (>= 3.1, < 5.0)
- rack (1.5.5)
+ rack (1.6.4)
rack-accept (0.4.5)
rack (>= 0.4)
rack-attack (4.3.0)
@@ -513,26 +540,35 @@ GEM
rack
rack-test (0.6.3)
rack (>= 1.0)
- rails (4.1.14)
- actionmailer (= 4.1.14)
- actionpack (= 4.1.14)
- actionview (= 4.1.14)
- activemodel (= 4.1.14)
- activerecord (= 4.1.14)
- activesupport (= 4.1.14)
+ rails (4.2.4)
+ actionmailer (= 4.2.4)
+ actionpack (= 4.2.4)
+ actionview (= 4.2.4)
+ activejob (= 4.2.4)
+ activemodel (= 4.2.4)
+ activerecord (= 4.2.4)
+ activesupport (= 4.2.4)
bundler (>= 1.3.0, < 2.0)
- railties (= 4.1.14)
- sprockets-rails (~> 2.0)
- railties (4.1.14)
- actionpack (= 4.1.14)
- activesupport (= 4.1.14)
+ railties (= 4.2.4)
+ sprockets-rails
+ rails-deprecated_sanitizer (1.0.3)
+ activesupport (>= 4.2.0.alpha)
+ rails-dom-testing (1.0.7)
+ activesupport (>= 4.2.0.beta, < 5.0)
+ nokogiri (~> 1.6.0)
+ rails-deprecated_sanitizer (>= 1.0.1)
+ rails-html-sanitizer (1.0.2)
+ loofah (~> 2.0)
+ railties (4.2.4)
+ actionpack (= 4.2.4)
+ activesupport (= 4.2.4)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.0.0)
raindrops (0.15.0)
rake (10.4.2)
raphael-rails (2.1.2)
- rb-fsevent (0.9.5)
+ rb-fsevent (0.9.6)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
rblineprof (0.3.6)
@@ -544,13 +580,13 @@ GEM
rdoc (3.12.2)
json (~> 1.4)
redcarpet (3.3.3)
- redis (3.2.1)
- redis-actionpack (4.0.0)
+ redis (3.2.2)
+ redis-actionpack (4.0.1)
actionpack (~> 4)
redis-rack (~> 1.5.0)
redis-store (~> 1.1.0)
- redis-activesupport (4.1.1)
- activesupport (~> 4)
+ redis-activesupport (4.1.5)
+ activesupport (>= 3, < 5)
redis-store (~> 1.1.0)
redis-namespace (1.5.2)
redis (~> 3.0, >= 3.0.4)
@@ -561,13 +597,13 @@ GEM
redis-actionpack (~> 4)
redis-activesupport (~> 4)
redis-store (~> 1.1.0)
- redis-store (1.1.6)
+ redis-store (1.1.7)
redis (>= 2.2)
- request_store (1.2.0)
+ request_store (1.2.1)
rerun (0.10.0)
listen (~> 2.7, >= 2.7.3)
- responders (1.1.2)
- railties (>= 3.2, < 4.2)
+ responders (2.1.0)
+ railties (>= 4.2.0, < 5)
rest-client (1.8.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0)
@@ -712,16 +748,16 @@ GEM
term-ansicolor (1.3.2)
tins (~> 1.0)
terminal-table (1.5.2)
- test_after_commit (0.2.7)
+ test_after_commit (0.4.2)
activerecord (>= 3.2)
- thin (1.6.3)
+ thin (1.6.4)
daemons (~> 1.0, >= 1.0.9)
- eventmachine (~> 1.0)
+ eventmachine (~> 1.0, >= 1.0.4)
rack (~> 1.0)
thor (0.19.1)
thread_safe (0.3.5)
tilt (1.4.1)
- timers (4.0.4)
+ timers (4.1.1)
hitimes
timfel-krb5-auth (0.8.3)
tinder (1.10.1)
@@ -754,9 +790,9 @@ GEM
kgio (~> 2.6)
rack
raindrops (~> 0.7)
- unicorn-worker-killer (0.4.3)
+ unicorn-worker-killer (0.4.4)
get_process_mem (~> 0)
- unicorn (~> 4)
+ unicorn (>= 4, < 6)
uniform_notifier (1.9.0)
uuid (2.3.8)
macaddr (~> 1.0)
@@ -768,10 +804,15 @@ GEM
equalizer (~> 0.0, >= 0.0.9)
warden (1.2.3)
rack (>= 1.0)
+ web-console (2.2.1)
+ activemodel (>= 4.0)
+ binding_of_caller (>= 0.7.2)
+ railties (>= 4.0)
+ sprockets-rails (>= 2.0, < 4.0)
webmock (1.21.0)
addressable (>= 2.3.6)
crack (>= 0.3.2)
- websocket-driver (0.6.2)
+ websocket-driver (0.6.3)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
wikicloth (0.8.1)
@@ -862,6 +903,7 @@ DEPENDENCIES
mousetrap-rails (~> 1.4.6)
mysql2 (~> 0.3.16)
nested_form (~> 0.3.2)
+ net-ssh (~> 3.0.1)
newrelic-grape
newrelic_rpm (~> 3.9.4.245)
nprogress-rails (~> 0.1.6.7)
@@ -887,7 +929,8 @@ DEPENDENCIES
rack-attack (~> 4.3.0)
rack-cors (~> 0.4.0)
rack-oauth2 (~> 1.2.1)
- rails (= 4.1.14)
+ rails (= 4.2.4)
+ rails-deprecated_sanitizer (~> 1.0.3)
raphael-rails (~> 2.1.2)
rblineprof
rdoc (~> 3.6)
@@ -895,6 +938,7 @@ DEPENDENCIES
redis-rails (~> 4.0.0)
request_store (~> 1.2.0)
rerun (~> 0.10.0)
+ responders (~> 2.0)
rqrcode-rails3 (~> 0.1.7)
rspec-rails (~> 3.3.0)
rubocop (~> 0.28.0)
@@ -924,7 +968,7 @@ DEPENDENCIES
task_list (~> 1.0.2)
teaspoon (~> 1.0.0)
teaspoon-jasmine (~> 2.2.0)
- test_after_commit (~> 0.2.2)
+ test_after_commit (~> 0.4.2)
thin (~> 1.6.1)
tinder (~> 1.10.0)
turbolinks (~> 2.5.0)
@@ -935,6 +979,7 @@ DEPENDENCIES
unicorn-worker-killer (~> 0.4.2)
version_sorter (~> 2.0.0)
virtus (~> 1.0.1)
+ web-console (~> 2.0)
webmock (~> 1.21.0)
wikicloth (= 0.8.1)
diff --git a/Procfile b/Procfile
index 08880b9c425..fd5f7ecb94b 100644
--- a/Procfile
+++ b/Procfile
@@ -1,3 +1,3 @@
web: bundle exec unicorn_rails -p ${PORT:="3000"} -E ${RAILS_ENV:="development"} -c ${UNICORN_CONFIG:="config/unicorn.rb"}
-worker: bundle exec sidekiq -q post_receive -q mailer -q archive_repo -q system_hook -q project_web_hook -q gitlab_shell -q incoming_email -q runner -q common -q default
+worker: bundle exec sidekiq -q post_receive -q mailer -q archive_repo -q system_hook -q project_web_hook -q gitlab_shell -q incoming_email -q runner -q common -q mailers -q default
# mail_room: bundle exec mail_room -q -c config/mail_room.yml
diff --git a/app/controllers/abuse_reports_controller.rb b/app/controllers/abuse_reports_controller.rb
index 2f4054eaa11..20bc5173f1d 100644
--- a/app/controllers/abuse_reports_controller.rb
+++ b/app/controllers/abuse_reports_controller.rb
@@ -10,7 +10,7 @@ class AbuseReportsController < ApplicationController
if @abuse_report.save
if current_application_settings.admin_notification_email.present?
- AbuseReportMailer.delay.notify(@abuse_report.id)
+ AbuseReportMailer.notify(@abuse_report.id).deliver_later
end
message = "Thank you for your report. A GitLab administrator will look into it shortly."
diff --git a/app/mailers/base_mailer.rb b/app/mailers/base_mailer.rb
index aedb0889185..8b83bbd93b7 100644
--- a/app/mailers/base_mailer.rb
+++ b/app/mailers/base_mailer.rb
@@ -8,10 +8,6 @@ class BaseMailer < ActionMailer::Base
default from: Proc.new { default_sender_address.format }
default reply_to: Proc.new { default_reply_to_address.format }
- def self.delay
- delay_for(2.seconds)
- end
-
def can?
Ability.abilities.allowed?(current_user, action, subject)
end
diff --git a/app/models/project_services/ci/mail_service.rb b/app/models/project_services/ci/mail_service.rb
index d31dd6899c1..bb961d06972 100644
--- a/app/models/project_services/ci/mail_service.rb
+++ b/app/models/project_services/ci/mail_service.rb
@@ -64,9 +64,9 @@ module Ci
build.project_recipients.each do |recipient|
case build.status.to_sym
when :success
- mailer.build_success_email(build.id, recipient)
+ mailer.build_success_email(build.id, recipient).deliver_later
when :failed
- mailer.build_fail_email(build.id, recipient)
+ mailer.build_fail_email(build.id, recipient).deliver_later
end
end
end
@@ -78,7 +78,7 @@ module Ci
end
def mailer
- Ci::Notify.delay
+ Ci::Notify
end
end
end
diff --git a/app/models/project_services/gitlab_ci_service.rb b/app/models/project_services/gitlab_ci_service.rb
index c5657b5070e..234e8e8b580 100644
--- a/app/models/project_services/gitlab_ci_service.rb
+++ b/app/models/project_services/gitlab_ci_service.rb
@@ -55,7 +55,7 @@ class GitlabCiService < CiService
end
def get_ci_commit(sha, ref)
- Ci::Project.find(project.gitlab_ci_project).commits.find_by_sha!(sha)
+ Ci::Project.find(project.gitlab_ci_project.id).commits.find_by_sha!(sha)
end
def commit_status(sha, ref)
diff --git a/app/models/sent_notification.rb b/app/models/sent_notification.rb
index 3eed5c16e45..d8fe65b06f6 100644
--- a/app/models/sent_notification.rb
+++ b/app/models/sent_notification.rb
@@ -17,9 +17,8 @@ class SentNotification < ActiveRecord::Base
belongs_to :noteable, polymorphic: true
belongs_to :recipient, class_name: "User"
- validate :project, :recipient, :reply_key, presence: true
- validate :reply_key, uniqueness: true
-
+ validates :project, :recipient, :reply_key, presence: true
+ validates :reply_key, uniqueness: true
validates :noteable_id, presence: true, unless: :for_commit?
validates :commit_id, presence: true, if: :for_commit?
validates :line_code, format: { with: /\A[a-z0-9]+_\d+_\d+\Z/ }, allow_blank: true
diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb
index d6550fbb555..388a4defb26 100644
--- a/app/services/notification_service.rb
+++ b/app/services/notification_service.rb
@@ -13,14 +13,14 @@ class NotificationService
# even if user disabled notifications
def new_key(key)
if key.user
- mailer.new_ssh_key_email(key.id)
+ mailer.new_ssh_key_email(key.id).deliver_later
end
end
# Always notify user about email added to profile
def new_email(email)
if email.user
- mailer.new_email_email(email.id)
+ mailer.new_email_email(email.id).deliver_later
end
end
@@ -79,17 +79,27 @@ class NotificationService
end
def merge_mr(merge_request, current_user)
- close_resource_email(merge_request, merge_request.target_project, current_user, 'merged_merge_request_email')
+ close_resource_email(
+ merge_request,
+ merge_request.target_project,
+ current_user,
+ 'merged_merge_request_email'
+ )
end
def reopen_mr(merge_request, current_user)
- reopen_resource_email(merge_request, merge_request.target_project, current_user, 'merge_request_status_email', 'reopened')
+ reopen_resource_email(
+ merge_request,
+ merge_request.target_project,
+ current_user, 'merge_request_status_email',
+ 'reopened'
+ )
end
# Notify new user with email after creation
def new_user(user, token = nil)
# Don't email omniauth created users
- mailer.new_user_email(user.id, token) unless user.identities.any?
+ mailer.new_user_email(user.id, token).deliver_later unless user.identities.any?
end
# Notify users on new note in system
@@ -138,50 +148,59 @@ class NotificationService
# build notify method like 'note_commit_email'
notify_method = "note_#{note.noteable_type.underscore}_email".to_sym
-
recipients.each do |recipient|
- mailer.send(notify_method, recipient.id, note.id)
+ mailer.send(notify_method, recipient.id, note.id).deliver_later
end
end
def invite_project_member(project_member, token)
- mailer.project_member_invited_email(project_member.id, token)
+ mailer.project_member_invited_email(project_member.id, token).deliver_later
end
def accept_project_invite(project_member)
- mailer.project_invite_accepted_email(project_member.id)
+ mailer.project_invite_accepted_email(project_member.id).deliver_later
end
def decline_project_invite(project_member)
- mailer.project_invite_declined_email(project_member.project.id, project_member.invite_email, project_member.access_level, project_member.created_by_id)
+ mailer.project_invite_declined_email(
+ project_member.project.id,
+ project_member.invite_email,
+ project_member.access_level,
+ project_member.created_by_id
+ ).deliver_later
end
def new_project_member(project_member)
- mailer.project_access_granted_email(project_member.id)
+ mailer.project_access_granted_email(project_member.id).deliver_later
end
def update_project_member(project_member)
- mailer.project_access_granted_email(project_member.id)
+ mailer.project_access_granted_email(project_member.id).deliver_later
end
def invite_group_member(group_member, token)
- mailer.group_member_invited_email(group_member.id, token)
+ mailer.group_member_invited_email(group_member.id, token).deliver_later
end
def accept_group_invite(group_member)
- mailer.group_invite_accepted_email(group_member.id)
+ mailer.group_invite_accepted_email(group_member.id).deliver_later
end
def decline_group_invite(group_member)
- mailer.group_invite_declined_email(group_member.group.id, group_member.invite_email, group_member.access_level, group_member.created_by_id)
+ mailer.group_invite_declined_email(
+ group_member.group.id,
+ group_member.invite_email,
+ group_member.access_level,
+ group_member.created_by_id
+ ).deliver_later
end
def new_group_member(group_member)
- mailer.group_access_granted_email(group_member.id)
+ mailer.group_access_granted_email(group_member.id).deliver_later
end
def update_group_member(group_member)
- mailer.group_access_granted_email(group_member.id)
+ mailer.group_access_granted_email(group_member.id).deliver_later
end
def project_was_moved(project, old_path_with_namespace)
@@ -189,7 +208,11 @@ class NotificationService
recipients = reject_muted_users(recipients, project)
recipients.each do |recipient|
- mailer.project_was_moved_email(project.id, recipient.id, old_path_with_namespace)
+ mailer.project_was_moved_email(
+ project.id,
+ recipient.id,
+ old_path_with_namespace
+ ).deliver_later
end
end
@@ -339,7 +362,7 @@ class NotificationService
recipients = build_recipients(target, project, target.author)
recipients.each do |recipient|
- mailer.send(method, recipient.id, target.id)
+ mailer.send(method, recipient.id, target.id).deliver_later
end
end
@@ -347,7 +370,7 @@ class NotificationService
recipients = build_recipients(target, project, current_user)
recipients.each do |recipient|
- mailer.send(method, recipient.id, target.id, current_user.id)
+ mailer.send(method, recipient.id, target.id, current_user.id).deliver_later
end
end
@@ -358,7 +381,13 @@ class NotificationService
recipients = build_recipients(target, project, current_user, [previous_assignee])
recipients.each do |recipient|
- mailer.send(method, recipient.id, target.id, previous_assignee_id, current_user.id)
+ mailer.send(
+ method,
+ recipient.id,
+ target.id,
+ previous_assignee_id,
+ current_user.id
+ ).deliver_later
end
end
@@ -366,7 +395,7 @@ class NotificationService
recipients = build_recipients(target, project, current_user)
recipients.each do |recipient|
- mailer.send(method, recipient.id, target.id, status, current_user.id)
+ mailer.send(method, recipient.id, target.id, status, current_user.id).deliver_later
end
end
@@ -388,7 +417,7 @@ class NotificationService
end
def mailer
- Notify.delay
+ Notify
end
def previous_record(object, attribute)
diff --git a/app/views/ci/admin/runners/show.html.haml b/app/views/ci/admin/runners/show.html.haml
index 1498db46a80..fd3d33d657b 100644
--- a/app/views/ci/admin/runners/show.html.haml
+++ b/app/views/ci/admin/runners/show.html.haml
@@ -37,7 +37,7 @@
= label_tag :tag_list, class: 'control-label' do
Tags
.col-sm-10
- = f.text_field :tag_list, class: 'form-control'
+ = f.text_field :tag_list, value: @runner.tag_list.to_s, class: 'form-control'
.help-block You can setup builds to only use runners with specific tags
.form-actions
= f.submit 'Save', class: 'btn btn-save'
diff --git a/app/views/ci/notify/build_success_email.html.haml b/app/views/ci/notify/build_success_email.html.haml
index 24c439e50eb..6ef1fd67d89 100644
--- a/app/views/ci/notify/build_success_email.html.haml
+++ b/app/views/ci/notify/build_success_email.html.haml
@@ -8,7 +8,7 @@
= @project.name
%p
- Commit: #{link_to @build.short_sha, namespace_project_commit_path(@build.gl_project.namespace, @build.gl_project, @build.sha)}
+ Commit: #{link_to @build.short_sha, namespace_project_commit_url(@build.gl_project.namespace, @build.gl_project, @build.sha)}
%p
Author: #{@build.commit.git_author_name}
%p
diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml
index 3ebc175648e..0c10de1604c 100644
--- a/app/views/projects/edit.html.haml
+++ b/app/views/projects/edit.html.haml
@@ -35,7 +35,7 @@
.form-group
= f.label :tag_list, "Tags", class: 'control-label'
.col-sm-10
- = f.text_field :tag_list, maxlength: 2000, class: "form-control"
+ = f.text_field :tag_list, value: @project.tag_list.to_s, maxlength: 2000, class: "form-control"
%p.help-block Separate tags with commas.
%fieldset.features
diff --git a/app/views/projects/runners/edit.html.haml b/app/views/projects/runners/edit.html.haml
index dde9e448cb9..a0324701690 100644
--- a/app/views/projects/runners/edit.html.haml
+++ b/app/views/projects/runners/edit.html.haml
@@ -23,7 +23,7 @@
= label_tag :tag_list, class: 'control-label' do
Tags
.col-sm-10
- = f.text_field :tag_list, class: 'form-control'
+ = f.text_field :tag_list, value: @runner.tag_list.to_s, class: 'form-control'
.help-block You can setup jobs to only use runners with specific tags
.form-actions
= f.submit 'Save', class: 'btn btn-save'
diff --git a/app/workers/email_receiver_worker.rb b/app/workers/email_receiver_worker.rb
index 5a921a73fe9..f2649e38eb3 100644
--- a/app/workers/email_receiver_worker.rb
+++ b/app/workers/email_receiver_worker.rb
@@ -46,6 +46,6 @@ class EmailReceiverWorker
return
end
- EmailRejectionMailer.delay.rejection(reason, raw, can_retry)
+ EmailRejectionMailer.rejection(reason, raw, can_retry).deliver_later
end
end
diff --git a/app/workers/emails_on_push_worker.rb b/app/workers/emails_on_push_worker.rb
index 916a99bb273..c4d8595d45d 100644
--- a/app/workers/emails_on_push_worker.rb
+++ b/app/workers/emails_on_push_worker.rb
@@ -53,7 +53,7 @@ class EmailsOnPushWorker
reverse_compare: reverse_compare,
send_from_committer_email: send_from_committer_email,
disable_diffs: disable_diffs
- ).deliver
+ ).deliver_now
# These are input errors and won't be corrected even if Sidekiq retries
rescue Net::SMTPFatalError, Net::SMTPSyntaxError => e
logger.info("Failed to send e-mail for project '#{project.name_with_namespace}' to #{recipient}: #{e}")
diff --git a/bin/ci/upgrade.rb b/bin/ci/upgrade.rb
index aab4f60ec60..aab4f60ec60 100644..100755
--- a/bin/ci/upgrade.rb
+++ b/bin/ci/upgrade.rb
diff --git a/bin/rails b/bin/rails
index 7feb6a30e69..5191e6927af 100755
--- a/bin/rails
+++ b/bin/rails
@@ -1,8 +1,4 @@
#!/usr/bin/env ruby
-begin
- load File.expand_path("../spring", __FILE__)
-rescue LoadError
-end
-APP_PATH = File.expand_path('../../config/application', __FILE__)
+APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
require 'rails/commands'
diff --git a/bin/rake b/bin/rake
index 0fb4e07e13a..17240489f64 100755
--- a/bin/rake
+++ b/bin/rake
@@ -1,7 +1,4 @@
#!/usr/bin/env ruby
-begin
- load File.expand_path("../spring", __FILE__)
-rescue LoadError
-end
-require 'bundler/setup'
-load Gem.bin_path('rake', 'rake')
+require_relative '../config/boot'
+require 'rake'
+Rake.application.run
diff --git a/bin/setup b/bin/setup
new file mode 100755
index 00000000000..acdb2c1389c
--- /dev/null
+++ b/bin/setup
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+require 'pathname'
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+Dir.chdir APP_ROOT do
+ # This script is a starting point to setup your application.
+ # Add necessary setup steps to this file:
+
+ puts "== Installing dependencies =="
+ system "gem install bundler --conservative"
+ system "bundle check || bundle install"
+
+ # puts "\n== Copying sample files =="
+ # unless File.exist?("config/database.yml")
+ # system "cp config/database.yml.sample config/database.yml"
+ # end
+
+ puts "\n== Preparing database =="
+ system "bin/rake db:setup"
+
+ puts "\n== Removing old logs and tempfiles =="
+ system "rm -f log/*"
+ system "rm -rf tmp/cache"
+
+ puts "\n== Restarting application server =="
+ system "touch tmp/restart.txt"
+end
diff --git a/bin/upgrade.rb b/bin/upgrade.rb
index a5caecf8526..a5caecf8526 100644..100755
--- a/bin/upgrade.rb
+++ b/bin/upgrade.rb
diff --git a/config/application.rb b/config/application.rb
index bfa2a809dd7..d255ff0719f 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -99,6 +99,10 @@ module Gitlab
redis_config_hash[:expires_in] = 2.weeks # Cache should not grow forever
config.cache_store = :redis_store, redis_config_hash
+ config.active_record.raise_in_transactional_callbacks = true
+
+ config.active_job.queue_adapter = :sidekiq
+
# This is needed for gitlab-shell
ENV['GITLAB_PATH_OUTSIDE_HOOK'] = ENV['PATH']
end
diff --git a/config/environment.rb b/config/environment.rb
index 3b186a9d57a..df3006d349c 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -2,4 +2,4 @@
require File.expand_path('../application', __FILE__)
# Initialize the rails application
-Gitlab::Application.initialize!
+Rails.application.initialize!
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 827a110c249..c22722c606b 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -1,4 +1,4 @@
-Gitlab::Application.configure do
+Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 3316ece3873..317b113e100 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -1,4 +1,4 @@
-Gitlab::Application.configure do
+Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
@@ -9,7 +9,7 @@ Gitlab::Application.configure do
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
- config.serve_static_assets = false
+ config.serve_static_files = false
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 955540837d3..f96ac6f9753 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -1,4 +1,4 @@
-Gitlab::Application.configure do
+Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
@@ -8,7 +8,7 @@ Gitlab::Application.configure do
config.cache_classes = false
# Configure static asset server for tests with Cache-Control for performance
- config.serve_static_assets = true
+ config.serve_static_files = true
config.static_cache_control = "public, max-age=3600"
# Show full error reports and disable caching
@@ -32,4 +32,6 @@ Gitlab::Application.configure do
config.eager_load = false
config.cache_store = :null_store
+
+ config.active_job.queue_adapter = :test
end
diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb
index 43adac8b2c6..54516e3f23d 100644
--- a/config/initializers/cookies_serializer.rb
+++ b/config/initializers/cookies_serializer.rb
@@ -1,3 +1,3 @@
# Be sure to restart your server when you modify this file.
-Gitlab::Application.config.action_dispatch.cookies_serializer = :hybrid
+Rails.application.config.action_dispatch.cookies_serializer = :hybrid
diff --git a/config/initializers/default_url_options.rb b/config/initializers/default_url_options.rb
index f9f88f95db9..8fd27b1d88e 100644
--- a/config/initializers/default_url_options.rb
+++ b/config/initializers/default_url_options.rb
@@ -8,4 +8,4 @@ unless Gitlab.config.gitlab_on_standard_port?
default_url_options[:port] = Gitlab.config.gitlab.port
end
-Gitlab::Application.routes.default_url_options = default_url_options
+Rails.application.routes.default_url_options = default_url_options
diff --git a/config/initializers/rack_attack.rb.example b/config/initializers/rack_attack.rb.example
index 2155ea14562..b1bbcca1d61 100644
--- a/config/initializers/rack_attack.rb.example
+++ b/config/initializers/rack_attack.rb.example
@@ -4,13 +4,13 @@
# If you change this file in a Merge Request, please also create a Merge Request on https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests
paths_to_be_protected = [
- "#{Gitlab::Application.config.relative_url_root}/users/password",
- "#{Gitlab::Application.config.relative_url_root}/users/sign_in",
- "#{Gitlab::Application.config.relative_url_root}/api/#{API::API.version}/session.json",
- "#{Gitlab::Application.config.relative_url_root}/api/#{API::API.version}/session",
- "#{Gitlab::Application.config.relative_url_root}/users",
- "#{Gitlab::Application.config.relative_url_root}/users/confirmation",
- "#{Gitlab::Application.config.relative_url_root}/unsubscribes/"
+ "#{Rails.application.config.relative_url_root}/users/password",
+ "#{Rails.application.config.relative_url_root}/users/sign_in",
+ "#{Rails.application.config.relative_url_root}/api/#{API::API.version}/session.json",
+ "#{Rails.application.config.relative_url_root}/api/#{API::API.version}/session",
+ "#{Rails.application.config.relative_url_root}/users",
+ "#{Rails.application.config.relative_url_root}/users/confirmation",
+ "#{Rails.application.config.relative_url_root}/unsubscribes/"
]
diff --git a/config/initializers/rack_lineprof.rb b/config/initializers/rack_lineprof.rb
index f0c006d811b..22e77a32c61 100644
--- a/config/initializers/rack_lineprof.rb
+++ b/config/initializers/rack_lineprof.rb
@@ -2,7 +2,7 @@
# with darker backgrounds. This patch tweaks the colors a bit so the output is
# actually readable.
if Rails.env.development? and RUBY_ENGINE == 'ruby' and ENV['ENABLE_LINEPROF']
- Gitlab::Application.config.middleware.use(Rack::Lineprof)
+ Rails.application.config.middleware.use(Rack::Lineprof)
module Rack
class Lineprof
diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb
index 1b518c3becf..dae3a4a9a93 100644
--- a/config/initializers/secret_token.rb
+++ b/config/initializers/secret_token.rb
@@ -22,15 +22,15 @@ def find_secure_token
end
end
-Gitlab::Application.config.secret_token = find_secure_token
-Gitlab::Application.config.secret_key_base = find_secure_token
+Rails.application.config.secret_token = find_secure_token
+Rails.application.config.secret_key_base = find_secure_token
# CI
def generate_new_secure_token
SecureRandom.hex(64)
end
-if Gitlab::Application.secrets.db_key_base.blank?
+if Rails.application.secrets.db_key_base.blank?
warn "Missing `db_key_base` for '#{Rails.env}' environment. The secrets will be generated and stored in `config/secrets.yml`"
all_secrets = YAML.load_file('config/secrets.yml') if File.exist?('config/secrets.yml')
@@ -46,5 +46,5 @@ if Gitlab::Application.secrets.db_key_base.blank?
file.write(YAML.dump(all_secrets))
end
- Gitlab::Application.secrets.db_key_base = env_secrets['db_key_base']
+ Rails.application.secrets.db_key_base = env_secrets['db_key_base']
end
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index f30178ff711..d5208b8c93e 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -13,11 +13,11 @@ end
unless Rails.env.test?
Gitlab::Application.config.session_store(
:redis_store, # Using the cookie_store would enable session replay attacks.
- servers: Gitlab::Application.config.cache_store[1].merge(namespace: 'session:gitlab'), # re-use the Redis config from the Rails cache store
+ servers: Rails.application.config.cache_store[1].merge(namespace: 'session:gitlab'), # re-use the Redis config from the Rails cache store
key: '_gitlab_session',
secure: Gitlab.config.gitlab.https,
httponly: true,
expire_after: Settings.gitlab['session_expire_delay'] * 60,
- path: (Gitlab::Application.config.relative_url_root.nil?) ? '/' : Gitlab::Application.config.relative_url_root
+ path: (Rails.application.config.relative_url_root.nil?) ? '/' : Gitlab::Application.config.relative_url_root
)
end
diff --git a/config/initializers/sherlock.rb b/config/initializers/sherlock.rb
index 42b0d78c85f..8f2ababb712 100644
--- a/config/initializers/sherlock.rb
+++ b/config/initializers/sherlock.rb
@@ -1,5 +1,5 @@
if Gitlab::Sherlock.enabled?
- Gitlab::Application.configure do |config|
+ Rails.application.configure do |config|
config.middleware.use(Gitlab::Sherlock::Middleware)
end
end
diff --git a/config/initializers/smtp_settings.rb.sample b/config/initializers/smtp_settings.rb.sample
index 25ec247a095..ec182502d4e 100644
--- a/config/initializers/smtp_settings.rb.sample
+++ b/config/initializers/smtp_settings.rb.sample
@@ -8,7 +8,7 @@
# If you change this file in a Merge Request, please also create a Merge Request on https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests
if Rails.env.production?
- Gitlab::Application.config.action_mailer.delivery_method = :smtp
+ Rails.application.config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
address: "email.server.com",
diff --git a/config/initializers/static_files.rb b/config/initializers/static_files.rb
index e6d5600edb7..d6dbf8b9fbf 100644
--- a/config/initializers/static_files.rb
+++ b/config/initializers/static_files.rb
@@ -1,6 +1,6 @@
-app = Gitlab::Application
+app = Rails.application
-if app.config.serve_static_assets
+if app.config.serve_static_files
# The `ActionDispatch::Static` middleware intercepts requests for static files
# by checking if they exist in the `/public` directory.
# We're replacing it with our `Gitlab::Middleware::Static` that does the same,
diff --git a/config/routes.rb b/config/routes.rb
index ac81a2aac76..5c114452a3f 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,7 +1,7 @@
require 'sidekiq/web'
require 'api/api'
-Gitlab::Application.routes.draw do
+Rails.application.routes.draw do
if Gitlab::Sherlock.enabled?
namespace :sherlock do
resources :transactions, only: [:index, :show] do
diff --git a/db/schema.rb b/db/schema.rb
index 5bbe0c908ef..fbcb711e569 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -16,7 +16,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
- create_table "abuse_reports", force: true do |t|
+ create_table "abuse_reports", force: :cascade do |t|
t.integer "reporter_id"
t.integer "user_id"
t.text "message"
@@ -24,7 +24,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
t.datetime "updated_at"
end
- create_table "application_settings", force: true do |t|
+ create_table "application_settings", force: :cascade do |t|
t.integer "default_projects_limit"
t.boolean "signup_enabled"
t.boolean "signin_enabled"
@@ -51,7 +51,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
t.integer "max_artifacts_size", default: 100, null: false
end
- create_table "audit_events", force: true do |t|
+ create_table "audit_events", force: :cascade do |t|
t.integer "author_id", null: false
t.string "type", null: false
t.integer "entity_id", null: false
@@ -65,7 +65,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "audit_events", ["entity_id", "entity_type"], name: "index_audit_events_on_entity_id_and_entity_type", using: :btree
add_index "audit_events", ["type"], name: "index_audit_events_on_type", using: :btree
- create_table "broadcast_messages", force: true do |t|
+ create_table "broadcast_messages", force: :cascade do |t|
t.text "message", null: false
t.datetime "starts_at"
t.datetime "ends_at"
@@ -76,14 +76,14 @@ ActiveRecord::Schema.define(version: 20151118162244) do
t.string "font"
end
- create_table "ci_application_settings", force: true do |t|
+ create_table "ci_application_settings", force: :cascade do |t|
t.boolean "all_broken_builds"
t.boolean "add_pusher"
t.datetime "created_at"
t.datetime "updated_at"
end
- create_table "ci_builds", force: true do |t|
+ create_table "ci_builds", force: :cascade do |t|
t.integer "project_id"
t.string "status"
t.datetime "finished_at"
@@ -123,7 +123,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "ci_builds", ["status"], name: "index_ci_builds_on_status", using: :btree
add_index "ci_builds", ["type"], name: "index_ci_builds_on_type", using: :btree
- create_table "ci_commits", force: true do |t|
+ create_table "ci_commits", force: :cascade do |t|
t.integer "project_id"
t.string "ref"
t.string "sha"
@@ -144,7 +144,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "ci_commits", ["project_id"], name: "index_ci_commits_on_project_id", using: :btree
add_index "ci_commits", ["sha"], name: "index_ci_commits_on_sha", using: :btree
- create_table "ci_events", force: true do |t|
+ create_table "ci_events", force: :cascade do |t|
t.integer "project_id"
t.integer "user_id"
t.integer "is_admin"
@@ -157,7 +157,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "ci_events", ["is_admin"], name: "index_ci_events_on_is_admin", using: :btree
add_index "ci_events", ["project_id"], name: "index_ci_events_on_project_id", using: :btree
- create_table "ci_jobs", force: true do |t|
+ create_table "ci_jobs", force: :cascade do |t|
t.integer "project_id", null: false
t.text "commands"
t.boolean "active", default: true, null: false
@@ -174,7 +174,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "ci_jobs", ["deleted_at"], name: "index_ci_jobs_on_deleted_at", using: :btree
add_index "ci_jobs", ["project_id"], name: "index_ci_jobs_on_project_id", using: :btree
- create_table "ci_projects", force: true do |t|
+ create_table "ci_projects", force: :cascade do |t|
t.string "name"
t.integer "timeout", default: 3600, null: false
t.datetime "created_at"
@@ -200,7 +200,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "ci_projects", ["gitlab_id"], name: "index_ci_projects_on_gitlab_id", using: :btree
add_index "ci_projects", ["shared_runners_enabled"], name: "index_ci_projects_on_shared_runners_enabled", using: :btree
- create_table "ci_runner_projects", force: true do |t|
+ create_table "ci_runner_projects", force: :cascade do |t|
t.integer "runner_id", null: false
t.integer "project_id", null: false
t.datetime "created_at"
@@ -210,7 +210,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "ci_runner_projects", ["project_id"], name: "index_ci_runner_projects_on_project_id", using: :btree
add_index "ci_runner_projects", ["runner_id"], name: "index_ci_runner_projects_on_runner_id", using: :btree
- create_table "ci_runners", force: true do |t|
+ create_table "ci_runners", force: :cascade do |t|
t.string "token"
t.datetime "created_at"
t.datetime "updated_at"
@@ -225,7 +225,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
t.string "architecture"
end
- create_table "ci_services", force: true do |t|
+ create_table "ci_services", force: :cascade do |t|
t.string "type"
t.string "title"
t.integer "project_id", null: false
@@ -237,7 +237,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "ci_services", ["project_id"], name: "index_ci_services_on_project_id", using: :btree
- create_table "ci_sessions", force: true do |t|
+ create_table "ci_sessions", force: :cascade do |t|
t.string "session_id", null: false
t.text "data"
t.datetime "created_at"
@@ -247,7 +247,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "ci_sessions", ["session_id"], name: "index_ci_sessions_on_session_id", using: :btree
add_index "ci_sessions", ["updated_at"], name: "index_ci_sessions_on_updated_at", using: :btree
- create_table "ci_taggings", force: true do |t|
+ create_table "ci_taggings", force: :cascade do |t|
t.integer "tag_id"
t.integer "taggable_id"
t.string "taggable_type"
@@ -260,14 +260,14 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "ci_taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "ci_taggings_idx", unique: true, using: :btree
add_index "ci_taggings", ["taggable_id", "taggable_type", "context"], name: "index_ci_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree
- create_table "ci_tags", force: true do |t|
+ create_table "ci_tags", force: :cascade do |t|
t.string "name"
t.integer "taggings_count", default: 0
end
add_index "ci_tags", ["name"], name: "index_ci_tags_on_name", unique: true, using: :btree
- create_table "ci_trigger_requests", force: true do |t|
+ create_table "ci_trigger_requests", force: :cascade do |t|
t.integer "trigger_id", null: false
t.text "variables"
t.datetime "created_at"
@@ -275,7 +275,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
t.integer "commit_id"
end
- create_table "ci_triggers", force: true do |t|
+ create_table "ci_triggers", force: :cascade do |t|
t.string "token"
t.integer "project_id", null: false
t.datetime "deleted_at"
@@ -285,7 +285,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "ci_triggers", ["deleted_at"], name: "index_ci_triggers_on_deleted_at", using: :btree
- create_table "ci_variables", force: true do |t|
+ create_table "ci_variables", force: :cascade do |t|
t.integer "project_id", null: false
t.string "key"
t.text "value"
@@ -296,14 +296,14 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "ci_variables", ["project_id"], name: "index_ci_variables_on_project_id", using: :btree
- create_table "ci_web_hooks", force: true do |t|
+ create_table "ci_web_hooks", force: :cascade do |t|
t.string "url", null: false
t.integer "project_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
end
- create_table "deploy_keys_projects", force: true do |t|
+ create_table "deploy_keys_projects", force: :cascade do |t|
t.integer "deploy_key_id", null: false
t.integer "project_id", null: false
t.datetime "created_at"
@@ -312,7 +312,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "deploy_keys_projects", ["project_id"], name: "index_deploy_keys_projects_on_project_id", using: :btree
- create_table "emails", force: true do |t|
+ create_table "emails", force: :cascade do |t|
t.integer "user_id", null: false
t.string "email", null: false
t.datetime "created_at"
@@ -322,7 +322,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "emails", ["email"], name: "index_emails_on_email", unique: true, using: :btree
add_index "emails", ["user_id"], name: "index_emails_on_user_id", using: :btree
- create_table "events", force: true do |t|
+ create_table "events", force: :cascade do |t|
t.string "target_type"
t.integer "target_id"
t.string "title"
@@ -341,7 +341,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "events", ["target_id"], name: "index_events_on_target_id", using: :btree
add_index "events", ["target_type"], name: "index_events_on_target_type", using: :btree
- create_table "forked_project_links", force: true do |t|
+ create_table "forked_project_links", force: :cascade do |t|
t.integer "forked_to_project_id", null: false
t.integer "forked_from_project_id", null: false
t.datetime "created_at"
@@ -350,7 +350,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "forked_project_links", ["forked_to_project_id"], name: "index_forked_project_links_on_forked_to_project_id", unique: true, using: :btree
- create_table "identities", force: true do |t|
+ create_table "identities", force: :cascade do |t|
t.string "extern_uid"
t.string "provider"
t.integer "user_id"
@@ -361,7 +361,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "identities", ["created_at", "id"], name: "index_identities_on_created_at_and_id", using: :btree
add_index "identities", ["user_id"], name: "index_identities_on_user_id", using: :btree
- create_table "issues", force: true do |t|
+ create_table "issues", force: :cascade do |t|
t.string "title"
t.integer "assignee_id"
t.integer "author_id"
@@ -387,7 +387,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "issues", ["state"], name: "index_issues_on_state", using: :btree
add_index "issues", ["title"], name: "index_issues_on_title", using: :btree
- create_table "keys", force: true do |t|
+ create_table "keys", force: :cascade do |t|
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
@@ -401,7 +401,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "keys", ["created_at", "id"], name: "index_keys_on_created_at_and_id", using: :btree
add_index "keys", ["user_id"], name: "index_keys_on_user_id", using: :btree
- create_table "label_links", force: true do |t|
+ create_table "label_links", force: :cascade do |t|
t.integer "label_id"
t.integer "target_id"
t.string "target_type"
@@ -412,7 +412,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "label_links", ["label_id"], name: "index_label_links_on_label_id", using: :btree
add_index "label_links", ["target_id", "target_type"], name: "index_label_links_on_target_id_and_target_type", using: :btree
- create_table "labels", force: true do |t|
+ create_table "labels", force: :cascade do |t|
t.string "title"
t.string "color"
t.integer "project_id"
@@ -423,7 +423,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "labels", ["project_id"], name: "index_labels_on_project_id", using: :btree
- create_table "lfs_objects", force: true do |t|
+ create_table "lfs_objects", force: :cascade do |t|
t.string "oid", null: false
t.integer "size", null: false
t.datetime "created_at"
@@ -433,7 +433,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "lfs_objects", ["oid"], name: "index_lfs_objects_on_oid", unique: true, using: :btree
- create_table "lfs_objects_projects", force: true do |t|
+ create_table "lfs_objects_projects", force: :cascade do |t|
t.integer "lfs_object_id", null: false
t.integer "project_id", null: false
t.datetime "created_at"
@@ -442,7 +442,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "lfs_objects_projects", ["project_id"], name: "index_lfs_objects_projects_on_project_id", using: :btree
- create_table "members", force: true do |t|
+ create_table "members", force: :cascade do |t|
t.integer "access_level", null: false
t.integer "source_id", null: false
t.string "source_type", null: false
@@ -464,7 +464,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "members", ["type"], name: "index_members_on_type", using: :btree
add_index "members", ["user_id"], name: "index_members_on_user_id", using: :btree
- create_table "merge_request_diffs", force: true do |t|
+ create_table "merge_request_diffs", force: :cascade do |t|
t.string "state"
t.text "st_commits"
t.text "st_diffs"
@@ -475,7 +475,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "merge_request_diffs", ["merge_request_id"], name: "index_merge_request_diffs_on_merge_request_id", unique: true, using: :btree
- create_table "merge_requests", force: true do |t|
+ create_table "merge_requests", force: :cascade do |t|
t.string "target_branch", null: false
t.string "source_branch", null: false
t.integer "source_project_id", null: false
@@ -507,7 +507,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "merge_requests", ["target_project_id", "iid"], name: "index_merge_requests_on_target_project_id_and_iid", unique: true, using: :btree
add_index "merge_requests", ["title"], name: "index_merge_requests_on_title", using: :btree
- create_table "milestones", force: true do |t|
+ create_table "milestones", force: :cascade do |t|
t.string "title", null: false
t.integer "project_id", null: false
t.text "description"
@@ -523,7 +523,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "milestones", ["project_id", "iid"], name: "index_milestones_on_project_id_and_iid", unique: true, using: :btree
add_index "milestones", ["project_id"], name: "index_milestones_on_project_id", using: :btree
- create_table "namespaces", force: true do |t|
+ create_table "namespaces", force: :cascade do |t|
t.string "name", null: false
t.string "path", null: false
t.integer "owner_id"
@@ -542,7 +542,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "namespaces", ["public"], name: "index_namespaces_on_public", using: :btree
add_index "namespaces", ["type"], name: "index_namespaces_on_type", using: :btree
- create_table "notes", force: true do |t|
+ create_table "notes", force: :cascade do |t|
t.text "note"
t.string "noteable_type"
t.integer "author_id"
@@ -571,7 +571,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "notes", ["project_id"], name: "index_notes_on_project_id", using: :btree
add_index "notes", ["updated_at"], name: "index_notes_on_updated_at", using: :btree
- create_table "oauth_access_grants", force: true do |t|
+ create_table "oauth_access_grants", force: :cascade do |t|
t.integer "resource_owner_id", null: false
t.integer "application_id", null: false
t.string "token", null: false
@@ -584,7 +584,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "oauth_access_grants", ["token"], name: "index_oauth_access_grants_on_token", unique: true, using: :btree
- create_table "oauth_access_tokens", force: true do |t|
+ create_table "oauth_access_tokens", force: :cascade do |t|
t.integer "resource_owner_id"
t.integer "application_id"
t.string "token", null: false
@@ -599,7 +599,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "oauth_access_tokens", ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id", using: :btree
add_index "oauth_access_tokens", ["token"], name: "index_oauth_access_tokens_on_token", unique: true, using: :btree
- create_table "oauth_applications", force: true do |t|
+ create_table "oauth_applications", force: :cascade do |t|
t.string "name", null: false
t.string "uid", null: false
t.string "secret", null: false
@@ -614,12 +614,12 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "oauth_applications", ["owner_id", "owner_type"], name: "index_oauth_applications_on_owner_id_and_owner_type", using: :btree
add_index "oauth_applications", ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree
- create_table "project_import_data", force: true do |t|
+ create_table "project_import_data", force: :cascade do |t|
t.integer "project_id"
t.text "data"
end
- create_table "projects", force: true do |t|
+ create_table "projects", force: :cascade do |t|
t.string "name"
t.string "path"
t.text "description"
@@ -656,7 +656,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "projects", ["star_count"], name: "index_projects_on_star_count", using: :btree
add_index "projects", ["visibility_level"], name: "index_projects_on_visibility_level", using: :btree
- create_table "protected_branches", force: true do |t|
+ create_table "protected_branches", force: :cascade do |t|
t.integer "project_id", null: false
t.string "name", null: false
t.datetime "created_at"
@@ -666,7 +666,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "protected_branches", ["project_id"], name: "index_protected_branches_on_project_id", using: :btree
- create_table "releases", force: true do |t|
+ create_table "releases", force: :cascade do |t|
t.string "tag"
t.text "description"
t.integer "project_id"
@@ -677,7 +677,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "releases", ["project_id", "tag"], name: "index_releases_on_project_id_and_tag", using: :btree
add_index "releases", ["project_id"], name: "index_releases_on_project_id", using: :btree
- create_table "sent_notifications", force: true do |t|
+ create_table "sent_notifications", force: :cascade do |t|
t.integer "project_id"
t.integer "noteable_id"
t.string "noteable_type"
@@ -689,7 +689,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "sent_notifications", ["reply_key"], name: "index_sent_notifications_on_reply_key", unique: true, using: :btree
- create_table "services", force: true do |t|
+ create_table "services", force: :cascade do |t|
t.string "type"
t.string "title"
t.integer "project_id"
@@ -709,7 +709,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "services", ["project_id"], name: "index_services_on_project_id", using: :btree
add_index "services", ["template"], name: "index_services_on_template", using: :btree
- create_table "snippets", force: true do |t|
+ create_table "snippets", force: :cascade do |t|
t.string "title"
t.text "content"
t.integer "author_id", null: false
@@ -729,7 +729,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "snippets", ["project_id"], name: "index_snippets_on_project_id", using: :btree
add_index "snippets", ["visibility_level"], name: "index_snippets_on_visibility_level", using: :btree
- create_table "subscriptions", force: true do |t|
+ create_table "subscriptions", force: :cascade do |t|
t.integer "user_id"
t.integer "subscribable_id"
t.string "subscribable_type"
@@ -740,7 +740,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "subscriptions", ["subscribable_id", "subscribable_type", "user_id"], name: "subscriptions_user_id_and_ref_fields", unique: true, using: :btree
- create_table "taggings", force: true do |t|
+ create_table "taggings", force: :cascade do |t|
t.integer "tag_id"
t.integer "taggable_id"
t.string "taggable_type"
@@ -753,14 +753,14 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true, using: :btree
add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree
- create_table "tags", force: true do |t|
+ create_table "tags", force: :cascade do |t|
t.string "name"
t.integer "taggings_count", default: 0
end
add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree
- create_table "users", force: true do |t|
+ create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
@@ -826,7 +826,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
add_index "users", ["username"], name: "index_users_on_username", using: :btree
- create_table "users_star_projects", force: true do |t|
+ create_table "users_star_projects", force: :cascade do |t|
t.integer "project_id", null: false
t.integer "user_id", null: false
t.datetime "created_at"
@@ -837,7 +837,7 @@ ActiveRecord::Schema.define(version: 20151118162244) do
add_index "users_star_projects", ["user_id", "project_id"], name: "index_users_star_projects_on_user_id_and_project_id", unique: true, using: :btree
add_index "users_star_projects", ["user_id"], name: "index_users_star_projects_on_user_id", using: :btree
- create_table "web_hooks", force: true do |t|
+ create_table "web_hooks", force: :cascade do |t|
t.string "url"
t.integer "project_id"
t.datetime "created_at"
diff --git a/lib/gitlab/github_import/client.rb b/lib/gitlab/github_import/client.rb
index 270cbcd9ccd..74d1529e1ff 100644
--- a/lib/gitlab/github_import/client.rb
+++ b/lib/gitlab/github_import/client.rb
@@ -46,7 +46,7 @@ module Gitlab
end
def github_options
- OmniAuth::Strategies::GitHub.default_options[:client_options].symbolize_keys
+ OmniAuth::Strategies::GitHub.default_options[:client_options].to_h.symbolize_keys
end
end
end
diff --git a/lib/gitlab/gitlab_import/client.rb b/lib/gitlab/gitlab_import/client.rb
index 9c00896c913..86fb6c51765 100644
--- a/lib/gitlab/gitlab_import/client.rb
+++ b/lib/gitlab/gitlab_import/client.rb
@@ -75,7 +75,7 @@ module Gitlab
end
def gitlab_options
- OmniAuth::Strategies::GitLab.default_options[:client_options].symbolize_keys
+ OmniAuth::Strategies::GitLab.default_options[:client_options].to_h.symbolize_keys
end
end
end
diff --git a/lib/gitlab/markdown/label_reference_filter.rb b/lib/gitlab/markdown/label_reference_filter.rb
index 618acb7a578..13581b8fb13 100644
--- a/lib/gitlab/markdown/label_reference_filter.rb
+++ b/lib/gitlab/markdown/label_reference_filter.rb
@@ -60,8 +60,7 @@ module Gitlab
def url_for_label(project, label)
h = Gitlab::Application.routes.url_helpers
h.namespace_project_issues_path(project.namespace, project,
- label_name: label.name,
- only_path: context[:only_path])
+ label_name: label.name)
end
def render_colored_label(label)
diff --git a/lib/gitlab/seeder.rb b/lib/gitlab/seeder.rb
index 31aa3528c4c..2ef0e982256 100644
--- a/lib/gitlab/seeder.rb
+++ b/lib/gitlab/seeder.rb
@@ -14,7 +14,7 @@ module Gitlab
def self.mute_mailer
code = <<-eos
-def Notify.delay
+def Notify.deliver_later
self
end
eos
diff --git a/spec/controllers/abuse_reports_controller_spec.rb b/spec/controllers/abuse_reports_controller_spec.rb
index 0faab8d7ff0..15824a1c67f 100644
--- a/spec/controllers/abuse_reports_controller_spec.rb
+++ b/spec/controllers/abuse_reports_controller_spec.rb
@@ -18,27 +18,31 @@ describe AbuseReportsController do
end
it "sends a notification email" do
- post :create,
- abuse_report: {
- user_id: user.id,
- message: message
- }
-
- email = ActionMailer::Base.deliveries.last
-
- expect(email.to).to eq([admin_email])
- expect(email.subject).to include(user.username)
- expect(email.text_part.body).to include(message)
- end
-
- it "saves the abuse report" do
- expect do
+ perform_enqueued_jobs do
post :create,
abuse_report: {
user_id: user.id,
message: message
}
- end.to change { AbuseReport.count }.by(1)
+
+ email = ActionMailer::Base.deliveries.last
+
+ expect(email.to).to eq([admin_email])
+ expect(email.subject).to include(user.username)
+ expect(email.text_part.body).to include(message)
+ end
+ end
+
+ it "saves the abuse report" do
+ perform_enqueued_jobs do
+ expect do
+ post :create,
+ abuse_report: {
+ user_id: user.id,
+ message: message
+ }
+ end.to change { AbuseReport.count }.by(1)
+ end
end
end
diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb
index 4c756a8e732..86f01faffb4 100644
--- a/spec/features/admin/admin_users_spec.rb
+++ b/spec/features/admin/admin_users_spec.rb
@@ -87,13 +87,16 @@ describe "Admin::Users", feature: true do
end
it "should call send mail" do
- expect(Notify).to receive(:new_user_email)
+ expect_any_instance_of(NotificationService).to receive(:new_user)
click_button "Create user"
end
it "should send valid email to user with email & password" do
- click_button "Create user"
+ perform_enqueued_jobs do
+ click_button "Create user"
+ end
+
user = User.find_by(username: 'bang')
email = ActionMailer::Base.deliveries.last
expect(email.subject).to have_content('Account was created')
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index 670be75f763..0a64b70d6a6 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -59,7 +59,7 @@ describe ApplicationHelper do
avatar_url = "http://localhost/uploads/project/avatar/#{project.id}/banana_sample.gif"
expect(helper.project_icon("#{project.namespace.to_param}/#{project.to_param}").to_s).
- to eq "<img alt=\"Banana sample\" src=\"#{avatar_url}\" />"
+ to eq "<img src=\"#{avatar_url}\" alt=\"Banana sample\" />"
end
it 'should give uploaded icon when present' do
diff --git a/spec/lib/gitlab/markdown/label_reference_filter_spec.rb b/spec/lib/gitlab/markdown/label_reference_filter_spec.rb
index fc21b65a843..ae286c8be2b 100644
--- a/spec/lib/gitlab/markdown/label_reference_filter_spec.rb
+++ b/spec/lib/gitlab/markdown/label_reference_filter_spec.rb
@@ -71,7 +71,7 @@ module Gitlab::Markdown
doc = filter("See #{reference}")
expect(doc.css('a').first.attr('href')).to eq urls.
- namespace_project_issues_url(project.namespace, project, label_name: label.name)
+ namespace_project_issues_path(project.namespace, project, label_name: label.name)
end
it 'links with adjacent text' do
@@ -94,7 +94,7 @@ module Gitlab::Markdown
doc = filter("See #{reference}")
expect(doc.css('a').first.attr('href')).to eq urls.
- namespace_project_issues_url(project.namespace, project, label_name: label.name)
+ namespace_project_issues_path(project.namespace, project, label_name: label.name)
expect(doc.text).to eq 'See gfm'
end
@@ -118,7 +118,7 @@ module Gitlab::Markdown
doc = filter("See #{reference}")
expect(doc.css('a').first.attr('href')).to eq urls.
- namespace_project_issues_url(project.namespace, project, label_name: label.name)
+ namespace_project_issues_path(project.namespace, project, label_name: label.name)
expect(doc.text).to eq 'See gfm references'
end
diff --git a/spec/models/ci/project_services/mail_service_spec.rb b/spec/models/ci/project_services/mail_service_spec.rb
index d9b3d34ff15..c03be3ef75f 100644
--- a/spec/models/ci/project_services/mail_service_spec.rb
+++ b/spec/models/ci/project_services/mail_service_spec.rb
@@ -44,13 +44,10 @@ describe Ci::MailService do
end
it do
- should_email("git@example.com")
- mail.execute(build)
- end
-
- def should_email(email)
- expect(Ci::Notify).to receive(:build_fail_email).with(build.id, email)
- expect(Ci::Notify).not_to receive(:build_success_email).with(build.id, email)
+ perform_enqueued_jobs do
+ expect{ mail.execute(build) }.to change{ ActionMailer::Base.deliveries.size }.by(1)
+ expect(ActionMailer::Base.deliveries.last.to).to eq(["git@example.com"])
+ end
end
end
@@ -67,13 +64,10 @@ describe Ci::MailService do
end
it do
- should_email("git@example.com")
- mail.execute(build)
- end
-
- def should_email(email)
- expect(Ci::Notify).to receive(:build_success_email).with(build.id, email)
- expect(Ci::Notify).not_to receive(:build_fail_email).with(build.id, email)
+ perform_enqueued_jobs do
+ expect{ mail.execute(build) }.to change{ ActionMailer::Base.deliveries.size }.by(1)
+ expect(ActionMailer::Base.deliveries.last.to).to eq(["git@example.com"])
+ end
end
end
@@ -95,14 +89,12 @@ describe Ci::MailService do
end
it do
- should_email("git@example.com")
- should_email("jeroen@example.com")
- mail.execute(build)
- end
-
- def should_email(email)
- expect(Ci::Notify).to receive(:build_success_email).with(build.id, email)
- expect(Ci::Notify).not_to receive(:build_fail_email).with(build.id, email)
+ perform_enqueued_jobs do
+ expect{ mail.execute(build) }.to change{ ActionMailer::Base.deliveries.size }.by(2)
+ expect(
+ ActionMailer::Base.deliveries.map(&:to).flatten
+ ).to include("git@example.com", "jeroen@example.com")
+ end
end
end
@@ -124,14 +116,11 @@ describe Ci::MailService do
end
it do
- should_email(commit.git_author_email)
- should_email("jeroen@example.com")
- mail.execute(build) if mail.can_execute?(build)
- end
-
- def should_email(email)
- expect(Ci::Notify).not_to receive(:build_success_email).with(build.id, email)
- expect(Ci::Notify).not_to receive(:build_fail_email).with(build.id, email)
+ perform_enqueued_jobs do
+ expect do
+ mail.execute(build) if mail.can_execute?(build)
+ end.to_not change{ ActionMailer::Base.deliveries.size }
+ end
end
end
@@ -177,14 +166,11 @@ describe Ci::MailService do
it do
Ci::Build.retry(build)
- should_email(commit.git_author_email)
- should_email("jeroen@example.com")
- mail.execute(build) if mail.can_execute?(build)
- end
-
- def should_email(email)
- expect(Ci::Notify).not_to receive(:build_success_email).with(build.id, email)
- expect(Ci::Notify).not_to receive(:build_fail_email).with(build.id, email)
+ perform_enqueued_jobs do
+ expect do
+ mail.execute(build) if mail.can_execute?(build)
+ end.to_not change{ ActionMailer::Base.deliveries.size }
+ end
end
end
end
diff --git a/spec/models/project_services/jira_service_spec.rb b/spec/models/project_services/jira_service_spec.rb
index ddd2cce212c..576f5fc79eb 100644
--- a/spec/models/project_services/jira_service_spec.rb
+++ b/spec/models/project_services/jira_service_spec.rb
@@ -94,9 +94,9 @@ describe JiraService do
end
it 'should be prepopulated with the settings' do
- expect(@service.properties[:project_url]).to eq('http://jira.sample/projects/project_a')
- expect(@service.properties[:issues_url]).to eq("http://jira.sample/issues/:id")
- expect(@service.properties[:new_issue_url]).to eq("http://jira.sample/projects/project_a/issues/new")
+ expect(@service.properties["project_url"]).to eq('http://jira.sample/projects/project_a')
+ expect(@service.properties["issues_url"]).to eq("http://jira.sample/issues/:id")
+ expect(@service.properties["new_issue_url"]).to eq("http://jira.sample/projects/project_a/issues/new")
end
end
end
diff --git a/spec/services/issues/close_service_spec.rb b/spec/services/issues/close_service_spec.rb
index db547ce0d50..d711e3da104 100644
--- a/spec/services/issues/close_service_spec.rb
+++ b/spec/services/issues/close_service_spec.rb
@@ -14,7 +14,9 @@ describe Issues::CloseService do
describe :execute do
context "valid params" do
before do
- @issue = Issues::CloseService.new(project, user, {}).execute(issue)
+ perform_enqueued_jobs do
+ @issue = Issues::CloseService.new(project, user, {}).execute(issue)
+ end
end
it { expect(@issue).to be_valid }
diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb
index cc3e6483261..73d0b7f7abe 100644
--- a/spec/services/issues/update_service_spec.rb
+++ b/spec/services/issues/update_service_spec.rb
@@ -36,7 +36,10 @@ describe Issues::UpdateService do
label_ids: [label.id]
}
- @issue = Issues::UpdateService.new(project, user, opts).execute(issue)
+ perform_enqueued_jobs do
+ @issue = Issues::UpdateService.new(project, user, opts).execute(issue)
+ end
+
@issue.reload
end
diff --git a/spec/services/merge_requests/close_service_spec.rb b/spec/services/merge_requests/close_service_spec.rb
index b3cbfd4b5b8..272f3897938 100644
--- a/spec/services/merge_requests/close_service_spec.rb
+++ b/spec/services/merge_requests/close_service_spec.rb
@@ -18,7 +18,9 @@ describe MergeRequests::CloseService do
before do
allow(service).to receive(:execute_hooks)
- @merge_request = service.execute(merge_request)
+ perform_enqueued_jobs do
+ @merge_request = service.execute(merge_request)
+ end
end
it { expect(@merge_request).to be_valid }
diff --git a/spec/services/merge_requests/merge_service_spec.rb b/spec/services/merge_requests/merge_service_spec.rb
index 7483f51de03..c0961ceb11e 100644
--- a/spec/services/merge_requests/merge_service_spec.rb
+++ b/spec/services/merge_requests/merge_service_spec.rb
@@ -17,8 +17,9 @@ describe MergeRequests::MergeService do
before do
allow(service).to receive(:execute_hooks)
-
- service.execute(merge_request, 'Awesome message')
+ perform_enqueued_jobs do
+ service.execute(merge_request, 'Awesome message')
+ end
end
it { expect(merge_request).to be_valid }
diff --git a/spec/services/merge_requests/reopen_service_spec.rb b/spec/services/merge_requests/reopen_service_spec.rb
index 9401bc3b558..05146bf43f4 100644
--- a/spec/services/merge_requests/reopen_service_spec.rb
+++ b/spec/services/merge_requests/reopen_service_spec.rb
@@ -19,7 +19,9 @@ describe MergeRequests::ReopenService do
allow(service).to receive(:execute_hooks)
merge_request.state = :closed
- service.execute(merge_request)
+ perform_enqueued_jobs do
+ service.execute(merge_request)
+ end
end
it { expect(merge_request).to be_valid }
diff --git a/spec/services/merge_requests/update_service_spec.rb b/spec/services/merge_requests/update_service_spec.rb
index 97f5c009aec..d899b1f01d1 100644
--- a/spec/services/merge_requests/update_service_spec.rb
+++ b/spec/services/merge_requests/update_service_spec.rb
@@ -42,8 +42,10 @@ describe MergeRequests::UpdateService do
before do
allow(service).to receive(:execute_hooks)
- @merge_request = service.execute(merge_request)
- @merge_request.reload
+ perform_enqueued_jobs do
+ @merge_request = service.execute(merge_request)
+ @merge_request.reload
+ end
end
it { expect(@merge_request).to be_valid }
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb
index 520140917aa..a4e2b2953cc 100644
--- a/spec/services/notification_service_spec.rb
+++ b/spec/services/notification_service_spec.rb
@@ -3,6 +3,12 @@ require 'spec_helper'
describe NotificationService do
let(:notification) { NotificationService.new }
+ around(:each) do |example|
+ perform_enqueued_jobs do
+ example.run
+ end
+ end
+
describe 'Keys' do
describe :new_key do
let!(:key) { create(:personal_key) }
@@ -10,8 +16,7 @@ describe NotificationService do
it { expect(notification.new_key(key)).to be_truthy }
it 'should sent email to key owner' do
- expect(Notify).to receive(:new_ssh_key_email).with(key.id)
- notification.new_key(key)
+ expect{ notification.new_key(key) }.to change{ ActionMailer::Base.deliveries.size }.by(1)
end
end
end
@@ -23,8 +28,7 @@ describe NotificationService do
it { expect(notification.new_email(email)).to be_truthy }
it 'should send email to email owner' do
- expect(Notify).to receive(:new_email_email).with(email.id)
- notification.new_email(email)
+ expect{ notification.new_email(email) }.to change{ ActionMailer::Base.deliveries.size }.by(1)
end
end
end
@@ -47,18 +51,20 @@ describe NotificationService do
it do
add_users_with_subscription(note.project, issue)
- should_email(@u_watcher.id)
- should_email(note.noteable.author_id)
- should_email(note.noteable.assignee_id)
- should_email(@u_mentioned.id)
- should_email(@subscriber.id)
- should_not_email(note.author_id)
- should_not_email(@u_participating.id)
- should_not_email(@u_disabled.id)
- should_not_email(@unsubscriber.id)
- should_not_email(@u_outsider_mentioned)
+ ActionMailer::Base.deliveries.clear
notification.new_note(note)
+
+ should_email(@u_watcher)
+ should_email(note.noteable.author)
+ should_email(note.noteable.assignee)
+ should_email(@u_mentioned)
+ should_email(@subscriber)
+ should_not_email(note.author)
+ should_not_email(@u_participating)
+ should_not_email(@u_disabled)
+ should_not_email(@unsubscriber)
+ should_not_email(@u_outsider_mentioned)
end
it 'filters out "mentioned in" notes' do
@@ -82,26 +88,20 @@ describe NotificationService do
group_member = note.project.group.group_members.find_by_user_id(@u_watcher.id)
group_member.notification_level = Notification::N_GLOBAL
group_member.save
+ ActionMailer::Base.deliveries.clear
end
it do
- should_email(note.noteable.author_id)
- should_email(note.noteable.assignee_id)
- should_email(@u_mentioned.id)
- should_not_email(@u_watcher.id)
- should_not_email(note.author_id)
- should_not_email(@u_participating.id)
- should_not_email(@u_disabled.id)
notification.new_note(note)
- end
- end
- def should_email(user_id)
- expect(Notify).to receive(:note_issue_email).with(user_id, note.id)
- end
-
- def should_not_email(user_id)
- expect(Notify).not_to receive(:note_issue_email).with(user_id, note.id)
+ should_email(note.noteable.author)
+ should_email(note.noteable.assignee)
+ should_email(@u_mentioned)
+ should_not_email(@u_watcher)
+ should_not_email(note.author)
+ should_not_email(@u_participating)
+ should_not_email(@u_disabled)
+ end
end
end
@@ -113,24 +113,26 @@ describe NotificationService do
before do
build_team(note.project)
+ ActionMailer::Base.deliveries.clear
end
describe :new_note do
it do
+ notification.new_note(note)
+
# Notify all team members
note.project.team.members.each do |member|
# User with disabled notification should not be notified
next if member.id == @u_disabled.id
- should_email(member.id)
+ should_email(member)
end
- should_email(note.noteable.author_id)
- should_email(note.noteable.assignee_id)
- should_not_email(note.author_id)
- should_not_email(@u_mentioned.id)
- should_not_email(@u_disabled.id)
- should_not_email(@u_not_mentioned.id)
- notification.new_note(note)
+ should_email(note.noteable.author)
+ should_email(note.noteable.assignee)
+ should_not_email(note.author)
+ should_email(@u_mentioned)
+ should_not_email(@u_disabled)
+ should_email(@u_not_mentioned)
end
it 'filters out "mentioned in" notes' do
@@ -140,14 +142,6 @@ describe NotificationService do
notification.new_note(mentioned_note)
end
end
-
- def should_email(user_id)
- expect(Notify).to receive(:note_issue_email).with(user_id, note.id)
- end
-
- def should_not_email(user_id)
- expect(Notify).not_to receive(:note_issue_email).with(user_id, note.id)
- end
end
context 'commit note' do
@@ -156,43 +150,38 @@ describe NotificationService do
before do
build_team(note.project)
+ ActionMailer::Base.deliveries.clear
allow_any_instance_of(Commit).to receive(:author).and_return(@u_committer)
end
- describe :new_note do
+ describe :new_note, :perform_enqueued_jobs do
it do
- should_email(@u_committer.id, note)
- should_email(@u_watcher.id, note)
- should_not_email(@u_mentioned.id, note)
- should_not_email(note.author_id, note)
- should_not_email(@u_participating.id, note)
- should_not_email(@u_disabled.id, note)
notification.new_note(note)
+
+ should_email(@u_committer)
+ should_email(@u_watcher)
+ should_not_email(@u_mentioned)
+ should_not_email(note.author)
+ should_not_email(@u_participating)
+ should_not_email(@u_disabled)
end
it do
note.update_attribute(:note, '@mention referenced')
- should_email(@u_committer.id, note)
- should_email(@u_watcher.id, note)
- should_email(@u_mentioned.id, note)
- should_not_email(note.author_id, note)
- should_not_email(@u_participating.id, note)
- should_not_email(@u_disabled.id, note)
notification.new_note(note)
+
+ should_email(@u_committer)
+ should_email(@u_watcher)
+ should_email(@u_mentioned)
+ should_not_email(note.author)
+ should_not_email(@u_participating)
+ should_not_email(@u_disabled)
end
it do
@u_committer.update_attributes(notification_level: Notification::N_MENTION)
- should_not_email(@u_committer.id, note)
notification.new_note(note)
- end
-
- def should_email(user_id, n)
- expect(Notify).to receive(:note_commit_email).with(user_id, n.id)
- end
-
- def should_not_email(user_id, n)
- expect(Notify).not_to receive(:note_commit_email).with(user_id, n.id)
+ should_not_email(@u_committer)
end
end
end
@@ -205,99 +194,69 @@ describe NotificationService do
before do
build_team(issue.project)
add_users_with_subscription(issue.project, issue)
+ ActionMailer::Base.deliveries.clear
end
describe :new_issue do
it do
- should_email(issue.assignee_id)
- should_email(@u_watcher.id)
- should_email(@u_participant_mentioned.id)
- should_not_email(@u_mentioned.id)
- should_not_email(@u_participating.id)
- should_not_email(@u_disabled.id)
notification.new_issue(issue, @u_disabled)
+
+ should_email(issue.assignee)
+ should_email(@u_watcher)
+ should_email(@u_participant_mentioned)
+ should_not_email(@u_mentioned)
+ should_not_email(@u_participating)
+ should_not_email(@u_disabled)
end
it do
issue.assignee.update_attributes(notification_level: Notification::N_MENTION)
- should_not_email(issue.assignee_id)
notification.new_issue(issue, @u_disabled)
- end
-
- def should_email(user_id)
- expect(Notify).to receive(:new_issue_email).with(user_id, issue.id)
- end
- def should_not_email(user_id)
- expect(Notify).not_to receive(:new_issue_email).with(user_id, issue.id)
+ should_not_email(issue.assignee)
end
end
describe :reassigned_issue do
it 'should email new assignee' do
- should_email(issue.assignee_id)
- should_email(@u_watcher.id)
- should_email(@u_participant_mentioned.id)
- should_email(@subscriber.id)
- should_not_email(@unsubscriber.id)
- should_not_email(@u_participating.id)
- should_not_email(@u_disabled.id)
-
notification.reassigned_issue(issue, @u_disabled)
- end
-
- def should_email(user_id)
- expect(Notify).to receive(:reassigned_issue_email).with(user_id, issue.id, nil, @u_disabled.id)
- end
- def should_not_email(user_id)
- expect(Notify).not_to receive(:reassigned_issue_email).with(user_id, issue.id, issue.assignee_id, @u_disabled.id)
+ should_email(issue.assignee)
+ should_email(@u_watcher)
+ should_email(@u_participant_mentioned)
+ should_email(@subscriber)
+ should_not_email(@unsubscriber)
+ should_not_email(@u_participating)
+ should_not_email(@u_disabled)
end
end
describe :close_issue do
it 'should sent email to issue assignee and issue author' do
- should_email(issue.assignee_id)
- should_email(issue.author_id)
- should_email(@u_watcher.id)
- should_email(@u_participant_mentioned.id)
- should_email(@subscriber.id)
- should_not_email(@unsubscriber.id)
- should_not_email(@u_participating.id)
- should_not_email(@u_disabled.id)
-
notification.close_issue(issue, @u_disabled)
- end
- def should_email(user_id)
- expect(Notify).to receive(:closed_issue_email).with(user_id, issue.id, @u_disabled.id)
- end
-
- def should_not_email(user_id)
- expect(Notify).not_to receive(:closed_issue_email).with(user_id, issue.id, @u_disabled.id)
+ should_email(issue.assignee)
+ should_email(issue.author)
+ should_email(@u_watcher)
+ should_email(@u_participant_mentioned)
+ should_email(@subscriber)
+ should_not_email(@unsubscriber)
+ should_not_email(@u_participating)
+ should_not_email(@u_disabled)
end
end
describe :reopen_issue do
it 'should send email to issue assignee and issue author' do
- should_email(issue.assignee_id)
- should_email(issue.author_id)
- should_email(@u_watcher.id)
- should_email(@u_participant_mentioned.id)
- should_email(@subscriber.id)
- should_not_email(@unsubscriber.id)
- should_not_email(@u_participating.id)
- should_not_email(@u_disabled.id)
-
notification.reopen_issue(issue, @u_disabled)
- end
-
- def should_email(user_id)
- expect(Notify).to receive(:issue_status_changed_email).with(user_id, issue.id, 'reopened', @u_disabled.id)
- end
- def should_not_email(user_id)
- expect(Notify).not_to receive(:issue_status_changed_email).with(user_id, issue.id, 'reopened', @u_disabled.id)
+ should_email(issue.assignee)
+ should_email(issue.author)
+ should_email(@u_watcher)
+ should_email(@u_participant_mentioned)
+ should_email(@subscriber)
+ should_not_email(@unsubscriber)
+ should_not_email(@u_participating)
end
end
end
@@ -309,108 +268,74 @@ describe NotificationService do
before do
build_team(merge_request.target_project)
add_users_with_subscription(merge_request.target_project, merge_request)
+ ActionMailer::Base.deliveries.clear
end
describe :new_merge_request do
it do
- should_email(merge_request.assignee_id)
- should_email(@u_watcher.id)
- should_email(@u_participant_mentioned.id)
- should_not_email(@u_participating.id)
- should_not_email(@u_disabled.id)
notification.new_merge_request(merge_request, @u_disabled)
- end
- def should_email(user_id)
- expect(Notify).to receive(:new_merge_request_email).with(user_id, merge_request.id)
- end
-
- def should_not_email(user_id)
- expect(Notify).not_to receive(:new_merge_request_email).with(user_id, merge_request.id)
+ should_email(merge_request.assignee)
+ should_email(@u_watcher)
+ should_email(@u_participant_mentioned)
+ should_not_email(@u_participating)
+ should_not_email(@u_disabled)
end
end
describe :reassigned_merge_request do
it do
- should_email(merge_request.assignee_id)
- should_email(@u_watcher.id)
- should_email(@u_participant_mentioned.id)
- should_email(@subscriber.id)
- should_not_email(@unsubscriber.id)
- should_not_email(@u_participating.id)
- should_not_email(@u_disabled.id)
notification.reassigned_merge_request(merge_request, merge_request.author)
- end
-
- def should_email(user_id)
- expect(Notify).to receive(:reassigned_merge_request_email).with(user_id, merge_request.id, nil, merge_request.author_id)
- end
- def should_not_email(user_id)
- expect(Notify).not_to receive(:reassigned_merge_request_email).with(user_id, merge_request.id, merge_request.assignee_id, merge_request.author_id)
+ should_email(merge_request.assignee)
+ should_email(@u_watcher)
+ should_email(@u_participant_mentioned)
+ should_email(@subscriber)
+ should_not_email(@unsubscriber)
+ should_not_email(@u_participating)
+ should_not_email(@u_disabled)
end
end
describe :closed_merge_request do
it do
- should_email(merge_request.assignee_id)
- should_email(@u_watcher.id)
- should_email(@u_participant_mentioned.id)
- should_email(@subscriber.id)
- should_not_email(@unsubscriber.id)
- should_not_email(@u_participating.id)
- should_not_email(@u_disabled.id)
notification.close_mr(merge_request, @u_disabled)
- end
-
- def should_email(user_id)
- expect(Notify).to receive(:closed_merge_request_email).with(user_id, merge_request.id, @u_disabled.id)
- end
- def should_not_email(user_id)
- expect(Notify).not_to receive(:closed_merge_request_email).with(user_id, merge_request.id, @u_disabled.id)
+ should_email(merge_request.assignee)
+ should_email(@u_watcher)
+ should_email(@u_participant_mentioned)
+ should_email(@subscriber)
+ should_not_email(@unsubscriber)
+ should_not_email(@u_participating)
+ should_not_email(@u_disabled)
end
end
describe :merged_merge_request do
it do
- should_email(merge_request.assignee_id)
- should_email(@u_watcher.id)
- should_email(@u_participant_mentioned.id)
- should_email(@subscriber.id)
- should_not_email(@unsubscriber.id)
- should_not_email(@u_participating.id)
- should_not_email(@u_disabled.id)
notification.merge_mr(merge_request, @u_disabled)
- end
-
- def should_email(user_id)
- expect(Notify).to receive(:merged_merge_request_email).with(user_id, merge_request.id, @u_disabled.id)
- end
- def should_not_email(user_id)
- expect(Notify).not_to receive(:merged_merge_request_email).with(user_id, merge_request.id, @u_disabled.id)
+ should_email(merge_request.assignee)
+ should_email(@u_watcher)
+ should_email(@u_participant_mentioned)
+ should_email(@subscriber)
+ should_not_email(@unsubscriber)
+ should_not_email(@u_participating)
+ should_not_email(@u_disabled)
end
end
describe :reopen_merge_request do
it do
- should_email(merge_request.assignee_id)
- should_email(@u_watcher.id)
- should_email(@u_participant_mentioned.id)
- should_email(@subscriber.id)
- should_not_email(@unsubscriber.id)
- should_not_email(@u_participating.id)
- should_not_email(@u_disabled.id)
notification.reopen_mr(merge_request, @u_disabled)
- end
- def should_email(user_id)
- expect(Notify).to receive(:merge_request_status_email).with(user_id, merge_request.id, 'reopened', @u_disabled.id)
- end
-
- def should_not_email(user_id)
- expect(Notify).not_to receive(:merge_request_status_email).with(user_id, merge_request.id, 'reopened', @u_disabled.id)
+ should_email(merge_request.assignee)
+ should_email(@u_watcher)
+ should_email(@u_participant_mentioned)
+ should_email(@subscriber)
+ should_not_email(@unsubscriber)
+ should_not_email(@u_participating)
+ should_not_email(@u_disabled)
end
end
end
@@ -420,22 +345,16 @@ describe NotificationService do
before do
build_team(project)
+ ActionMailer::Base.deliveries.clear
end
describe :project_was_moved do
it do
- should_email(@u_watcher.id)
- should_email(@u_participating.id)
- should_not_email(@u_disabled.id)
notification.project_was_moved(project, "gitlab/gitlab")
- end
-
- def should_email(user_id)
- expect(Notify).to receive(:project_was_moved_email).with(project.id, user_id, "gitlab/gitlab")
- end
- def should_not_email(user_id)
- expect(Notify).not_to receive(:project_was_moved_email).with(project.id, user_id, "gitlab/gitlab")
+ should_email(@u_watcher)
+ should_email(@u_participating)
+ should_not_email(@u_disabled)
end
end
end
@@ -469,4 +388,18 @@ describe NotificationService do
issuable.subscriptions.create(user: @subscriber, subscribed: true)
issuable.subscriptions.create(user: @unsubscriber, subscribed: false)
end
+
+ def sent_to_user?(user)
+ ActionMailer::Base.deliveries.any? do |message|
+ message.to.include?(user.email)
+ end
+ end
+
+ def should_email(user)
+ expect(sent_to_user?(user)).to be_truthy
+ end
+
+ def should_not_email(user)
+ expect(sent_to_user?(user)).to be_falsey
+ end
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 2be13bb3e6a..0225a0ee53f 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -31,6 +31,7 @@ RSpec.configure do |config|
config.include StubConfiguration
config.include RelativeUrl, type: feature
config.include TestEnv
+ config.include ActiveJob::TestHelper
config.include StubGitlabCalls
config.include StubGitlabData
config.include BenchmarkMatchers, benchmark: true
diff --git a/spec/workers/email_receiver_worker_spec.rb b/spec/workers/email_receiver_worker_spec.rb
index 65a8d7d9197..de40a6f78af 100644
--- a/spec/workers/email_receiver_worker_spec.rb
+++ b/spec/workers/email_receiver_worker_spec.rb
@@ -21,12 +21,14 @@ describe EmailReceiverWorker do
end
it "sends out a rejection email" do
- described_class.new.perform(raw_message)
-
- email = ActionMailer::Base.deliveries.last
- expect(email).not_to be_nil
- expect(email.to).to eq(["jake@adventuretime.ooo"])
- expect(email.subject).to include("Rejected")
+ perform_enqueued_jobs do
+ described_class.new.perform(raw_message)
+
+ email = ActionMailer::Base.deliveries.last
+ expect(email).not_to be_nil
+ expect(email.to).to eq(["jake@adventuretime.ooo"])
+ expect(email.subject).to include("Rejected")
+ end
end
end
end