Commit 60828ab4 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'master' into link-refs

parents edc37c25 09e712c0
Please view this file on the master branch, on stable branches it's out of date. Please view this file on the master branch, on stable branches it's out of date.
v 8.3.0 (unreleased) v 8.3.0 (unreleased)
- Fix Error 500 when viewing user's personal projects from admin page (Stan Hu)
- Ensure cached application settings are refreshed at startup (Stan Hu)
- Fix: Assignee selector is empty when 'Unassigned' is selected (Jose Corcuera) - Fix: Assignee selector is empty when 'Unassigned' is selected (Jose Corcuera)
- Fix 500 error when update group member permission - Fix 500 error when update group member permission
- Fix: Raw private snippets access workflow
- Trim leading and trailing whitespace of milestone and issueable titles (Jose Corcuera) - Trim leading and trailing whitespace of milestone and issueable titles (Jose Corcuera)
- Recognize issue/MR/snippet/commit links as references - Recognize issue/MR/snippet/commit links as references
- Add ignore whitespace change option to commit view
- Fire update hook from GitLab
v 8.2.2
- Fix 404 in redirection after removing a project (Stan Hu)
- Ensure cached application settings are refreshed at startup (Stan Hu)
- Fix Error 500 when viewing user's personal projects from admin page (Stan Hu)
- Fix: Raw private snippets access workflow
- Prevent "413 Request entity too large" errors when pushing large files with LFS
v 8.2.1 v 8.2.1
- Forcefully update builds that didn't want to update with state machine - Forcefully update builds that didn't want to update with state machine
......
...@@ -27,6 +27,16 @@ The channels people will reach out on can be found on the [getting help page](ht ...@@ -27,6 +27,16 @@ The channels people will reach out on can be found on the [getting help page](ht
Sign up for the mailinglist, answer GitLab questions on StackOverflow or respond in the IRC channel. Sign up for the mailinglist, answer GitLab questions on StackOverflow or respond in the IRC channel.
You can also sign up on [CodeTriage](http://www.codetriage.com/gitlabhq/gitlabhq) to help with one issue every day. You can also sign up on [CodeTriage](http://www.codetriage.com/gitlabhq/gitlabhq) to help with one issue every day.
## I want to contribute!
If you want to contribute to GitLab, but are not sure where to start,
look for [issues](https://gitlab.com/gitlab-org/gitlab-ce/issues?milestone_id=&scope=all&sort=created_desc&state=opened&utf8=%E2%9C%93&assignee_id=&author_id=&milestone_title=&label_name=up-for-grabs)
with the label `up-for-grabs`.
These issues will be of reasonable size and challenge, for anyone to start
contributing to GitLab.
This was inspired by [an article by Kent C. Dodds](https://medium.com/@kentcdodds/first-timers-only-78281ea47455#.i2f363mx4).
## Issue tracker ## Issue tracker
To get support for your particular problem please use the [getting help channels](https://about.gitlab.com/getting-help/). To get support for your particular problem please use the [getting help channels](https://about.gitlab.com/getting-help/).
......
source "https://rubygems.org" 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 # Specify a sprockets version due to security issue
# See https://groups.google.com/forum/#!topic/rubyonrails-security/doAVp0YaTqY # See https://groups.google.com/forum/#!topic/rubyonrails-security/doAVp0YaTqY
...@@ -95,6 +99,7 @@ gem 'org-ruby', '~> 0.9.12' ...@@ -95,6 +99,7 @@ gem 'org-ruby', '~> 0.9.12'
gem 'creole', '~> 0.5.0' gem 'creole', '~> 0.5.0'
gem 'wikicloth', '0.8.1' gem 'wikicloth', '0.8.1'
gem 'asciidoctor', '~> 1.5.2' gem 'asciidoctor', '~> 1.5.2'
gem 'net-ssh', '~> 3.0.1'
# Diffs # Diffs
gem 'diffy', '~> 3.0.3' gem 'diffy', '~> 3.0.3'
...@@ -210,6 +215,7 @@ group :development do ...@@ -210,6 +215,7 @@ group :development do
gem 'rerun', '~> 0.10.0' gem 'rerun', '~> 0.10.0'
gem 'bullet', require: false gem 'bullet', require: false
gem 'rblineprof', platform: :mri, require: false gem 'rblineprof', platform: :mri, require: false
gem 'web-console', '~> 2.0'
# Better errors handler # Better errors handler
gem 'better_errors', '~> 1.0.1' gem 'better_errors', '~> 1.0.1'
...@@ -266,7 +272,7 @@ group :test do ...@@ -266,7 +272,7 @@ group :test do
gem 'shoulda-matchers', '~> 2.8.0', require: false gem 'shoulda-matchers', '~> 2.8.0', require: false
gem 'email_spec', '~> 1.6.0' gem 'email_spec', '~> 1.6.0'
gem 'webmock', '~> 1.21.0' gem 'webmock', '~> 1.21.0'
gem 'test_after_commit', '~> 0.2.2' gem 'test_after_commit', '~> 0.4.2'
gem 'sham_rack' gem 'sham_rack'
end end
......
This diff is collapsed.
...@@ -44,6 +44,7 @@ Workflow labels are purposely not very detailed since that would be hard to keep ...@@ -44,6 +44,7 @@ Workflow labels are purposely not very detailed since that would be hard to keep
- *UX* needs needs help from a UX designer - *UX* needs needs help from a UX designer
- *Frontend* needs help from a Front-end engineer - *Frontend* needs help from a Front-end engineer
- *Graphics* needs help from a Graphics designer - *Graphics* needs help from a Graphics designer
- *up-for-grabs* is an issue suitable for first-time contributors, of reasonable difficulty and size. Not exclusive with other labels.
Example workflow: when a UX designer provided a design but it needs frontend work they remove the UX label and add the frontend label. Example workflow: when a UX designer provided a design but it needs frontend work they remove the UX label and add the frontend label.
......
web: bundle exec unicorn_rails -p ${PORT:="3000"} -E ${RAILS_ENV:="development"} -c ${UNICORN_CONFIG:="config/unicorn.rb"} 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 # mail_room: bundle exec mail_room -q -c config/mail_room.yml
app/assets/images/icon-link.png

726 Bytes | W: | H:

app/assets/images/icon-link.png

1.1 KB | W: | H:

app/assets/images/icon-link.png
app/assets/images/icon-link.png
app/assets/images/icon-link.png
app/assets/images/icon-link.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -10,7 +10,7 @@ class AbuseReportsController < ApplicationController ...@@ -10,7 +10,7 @@ class AbuseReportsController < ApplicationController
if @abuse_report.save if @abuse_report.save
if current_application_settings.admin_notification_email.present? if current_application_settings.admin_notification_email.present?
AbuseReportMailer.delay.notify(@abuse_report.id) AbuseReportMailer.notify(@abuse_report.id).deliver_later
end end
message = "Thank you for your report. A GitLab administrator will look into it shortly." message = "Thank you for your report. A GitLab administrator will look into it shortly."
......
...@@ -9,7 +9,7 @@ class AutocompleteController < ApplicationController ...@@ -9,7 +9,7 @@ class AutocompleteController < ApplicationController
@users = @users.reorder(:name) @users = @users.reorder(:name)
@users = @users.page(params[:page]).per(PER_PAGE) @users = @users.page(params[:page]).per(PER_PAGE)
unless params[:search].present? if params[:search].blank?
# Include current user if available to filter by "Me" # Include current user if available to filter by "Me"
if params[:current_user] && current_user if params[:current_user] && current_user
@users = [*@users, current_user].uniq @users = [*@users, current_user].uniq
......
...@@ -67,7 +67,12 @@ class Projects::CommitController < Projects::ApplicationController ...@@ -67,7 +67,12 @@ class Projects::CommitController < Projects::ApplicationController
end end
def define_show_vars def define_show_vars
if params[:w].to_i == 1
@diffs = commit.diffs({ ignore_whitespace_change: true })
else
@diffs = commit.diffs @diffs = commit.diffs
end
@notes_count = commit.notes.count @notes_count = commit.notes.count
@builds = ci_commit.builds if ci_commit @builds = ci_commit.builds if ci_commit
......
...@@ -123,7 +123,7 @@ class ProjectsController < ApplicationController ...@@ -123,7 +123,7 @@ class ProjectsController < ApplicationController
::Projects::DestroyService.new(@project, current_user, {}).execute ::Projects::DestroyService.new(@project, current_user, {}).execute
flash[:alert] = "Project '#{@project.name}' was deleted." flash[:alert] = "Project '#{@project.name}' was deleted."
redirect_back_or_default(default: dashboard_projects_path, options: {}) redirect_to dashboard_projects_path
rescue Projects::DestroyService::DestroyError => ex rescue Projects::DestroyService::DestroyError => ex
redirect_to edit_project_path(@project), alert: ex.message redirect_to edit_project_path(@project), alert: ex.message
end end
......
...@@ -8,10 +8,6 @@ class BaseMailer < ActionMailer::Base ...@@ -8,10 +8,6 @@ class BaseMailer < ActionMailer::Base
default from: Proc.new { default_sender_address.format } default from: Proc.new { default_sender_address.format }
default reply_to: Proc.new { default_reply_to_address.format } default reply_to: Proc.new { default_reply_to_address.format }
def self.delay
delay_for(2.seconds)
end
def can? def can?
Ability.abilities.allowed?(current_user, action, subject) Ability.abilities.allowed?(current_user, action, subject)
end end
......
...@@ -64,9 +64,9 @@ module Ci ...@@ -64,9 +64,9 @@ module Ci
build.project_recipients.each do |recipient| build.project_recipients.each do |recipient|
case build.status.to_sym case build.status.to_sym
when :success when :success
mailer.build_success_email(build.id, recipient) mailer.build_success_email(build.id, recipient).deliver_later
when :failed when :failed
mailer.build_fail_email(build.id, recipient) mailer.build_fail_email(build.id, recipient).deliver_later
end end
end end
end end
...@@ -78,7 +78,7 @@ module Ci ...@@ -78,7 +78,7 @@ module Ci
end end
def mailer def mailer
Ci::Notify.delay Ci::Notify
end end
end end
end end
...@@ -55,7 +55,7 @@ class GitlabCiService < CiService ...@@ -55,7 +55,7 @@ class GitlabCiService < CiService
end end
def get_ci_commit(sha, ref) 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 end
def commit_status(sha, ref) def commit_status(sha, ref)
......
...@@ -571,9 +571,13 @@ class Repository ...@@ -571,9 +571,13 @@ class Repository
# Run GitLab pre-receive hook # Run GitLab pre-receive hook
pre_receive_hook = Gitlab::Git::Hook.new('pre-receive', path_to_repo) pre_receive_hook = Gitlab::Git::Hook.new('pre-receive', path_to_repo)
status = pre_receive_hook.trigger(gl_id, oldrev, newrev, ref) pre_receive_hook_status = pre_receive_hook.trigger(gl_id, oldrev, newrev, ref)
if status # Run GitLab update hook
update_hook = Gitlab::Git::Hook.new('update', path_to_repo)
update_hook_status = update_hook.trigger(gl_id, oldrev, newrev, ref)
if pre_receive_hook_status && update_hook_status
if was_empty if was_empty
# Create branch # Create branch
rugged.references.create(ref, newrev) rugged.references.create(ref, newrev)
...@@ -596,7 +600,7 @@ class Repository ...@@ -596,7 +600,7 @@ class Repository
# Remove tmp ref and return error to user # Remove tmp ref and return error to user
rugged.references.delete(tmp_ref) rugged.references.delete(tmp_ref)
raise PreReceiveError.new('Commit was rejected by pre-receive hook') raise PreReceiveError.new('Commit was rejected by git hook')
end end
end end
......
...@@ -17,9 +17,8 @@ class SentNotification < ActiveRecord::Base ...@@ -17,9 +17,8 @@ class SentNotification < ActiveRecord::Base
belongs_to :noteable, polymorphic: true belongs_to :noteable, polymorphic: true
belongs_to :recipient, class_name: "User" belongs_to :recipient, class_name: "User"
validate :project, :recipient, :reply_key, presence: true validates :project, :recipient, :reply_key, presence: true
validate :reply_key, uniqueness: true validates :reply_key, uniqueness: true
validates :noteable_id, presence: true, unless: :for_commit? validates :noteable_id, presence: true, unless: :for_commit?
validates :commit_id, presence: true, if: :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 validates :line_code, format: { with: /\A[a-z0-9]+_\d+_\d+\Z/ }, allow_blank: true
......
...@@ -13,14 +13,14 @@ class NotificationService ...@@ -13,14 +13,14 @@ class NotificationService
# even if user disabled notifications # even if user disabled notifications
def new_key(key) def new_key(key)
if key.user if key.user
mailer.new_ssh_key_email(key.id) mailer.new_ssh_key_email(key.id).deliver_later
end end
end end
# Always notify user about email added to profile # Always notify user about email added to profile
def new_email(email) def new_email(email)
if email.user if email.user
mailer.new_email_email(email.id) mailer.new_email_email(email.id).deliver_later
end end
end end
...@@ -79,17 +79,27 @@ class NotificationService ...@@ -79,17 +79,27 @@ class NotificationService
end end
def merge_mr(merge_request, current_user) 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 end
def reopen_mr(merge_request, current_user) 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 end
# Notify new user with email after creation # Notify new user with email after creation
def new_user(user, token = nil) def new_user(user, token = nil)
# Don't email omniauth created users # 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 end
# Notify users on new note in system # Notify users on new note in system
...@@ -138,50 +148,59 @@ class NotificationService ...@@ -138,50 +148,59 @@ class NotificationService
# build notify method like 'note_commit_email' # build notify method like 'note_commit_email'
notify_method = "note_#{note.noteable_type.underscore}_email".to_sym notify_method = "note_#{note.noteable_type.underscore}_email".to_sym
recipients.each do |recipient| recipients.each do |recipient|
mailer.send(notify_method, recipient.id, note.id) mailer.send(notify_method, recipient.id, note.id).deliver_later
end end
end end
def invite_project_member(project_member, token) 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 end
def accept_project_invite(project_member) 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 end
def decline_project_invite(project_member) 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 end
def new_project_member(project_member) 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 end
def update_project_member(project_member) 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 end
def invite_group_member(group_member, token) 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 end
def accept_group_invite(group_member) 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 end
def decline_group_invite(group_member) 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 end
def new_group_member(group_member) 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 end
def update_group_member(group_member) 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 end
def project_was_moved(project, old_path_with_namespace) def project_was_moved(project, old_path_with_namespace)
...@@ -189,7 +208,11 @@ class NotificationService ...@@ -189,7 +208,11 @@ class NotificationService
recipients = reject_muted_users(recipients, project) recipients = reject_muted_users(recipients, project)
recipients.each do |recipient| 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
end end
...@@ -339,7 +362,7 @@ class NotificationService ...@@ -339,7 +362,7 @@ class NotificationService
recipients = build_recipients(target, project, target.author) recipients = build_recipients(target, project, target.author)
recipients.each do |recipient| recipients.each do |recipient|
mailer.send(method, recipient.id, target.id) mailer.send(method, recipient.id, target.id).deliver_later
end end
end end
...@@ -347,7 +370,7 @@ class NotificationService ...@@ -347,7 +370,7 @@ class NotificationService
recipients = build_recipients(target, project, current_user) recipients = build_recipients(target, project, current_user)
recipients.each do |recipient| 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
end end
...@@ -358,7 +381,13 @@ class NotificationService ...@@ -358,7 +381,13 @@ class NotificationService
recipients = build_recipients(target, project, current_user, [previous_assignee]) recipients = build_recipients(target, project, current_user, [previous_assignee])
recipients.each do |recipient| 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
end end
...@@ -366,7 +395,7 @@ class NotificationService ...@@ -366,7 +395,7 @@ class NotificationService
recipients = build_recipients(target, project, current_user) recipients = build_recipients(target, project, current_user)
recipients.each do |recipient| 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
end end
...@@ -388,7 +417,7 @@ class NotificationService ...@@ -388,7 +417,7 @@ class NotificationService
end end
def mailer def mailer
Notify.delay Notify
end end
def previous_record(object, attribute) def previous_record(object, attribute)
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
= label_tag :tag_list, class: 'control-label' do = label_tag :tag_list, class: 'control-label' do
Tags Tags
.col-sm-10 .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 .help-block You can setup builds to only use runners with specific tags
.form-actions .form-actions
= f.submit 'Save', class: 'btn btn-save' = f.submit 'Save', class: 'btn btn-save'
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
= @project.name = @project.name
%p %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 %p
Author: #{@build.commit.git_author_name} Author: #{@build.commit.git_author_name}
%p %p
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
.form-group .form-group
= f.label :tag_list, "Tags", class: 'control-label' = f.label :tag_list, "Tags", class: 'control-label'
.col-sm-10 .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. %p.help-block Separate tags with commas.
%fieldset.features %fieldset.features
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
= label_tag :tag_list, class: 'control-label' do = label_tag :tag_list, class: 'control-label' do
Tags Tags
.col-sm-10 .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 .help-block You can setup jobs to only use runners with specific tags
.form-actions .form-actions
= f.submit 'Save', class: 'btn btn-save' = f.submit 'Save', class: 'btn btn-save'
...@@ -46,6 +46,6 @@ class EmailReceiverWorker ...@@ -46,6 +46,6 @@ class EmailReceiverWorker
return return
end end
EmailRejectionMailer.delay.rejection(reason, raw, can_retry) EmailRejectionMailer.rejection(reason, raw, can_retry).deliver_later
end end
end end
...@@ -53,7 +53,7 @@ class EmailsOnPushWorker ...@@ -53,7 +53,7 @@ class EmailsOnPushWorker
reverse_compare: reverse_compare, reverse_compare: reverse_compare,
send_from_committer_email: send_from_committer_email, send_from_committer_email: send_from_committer_email,
disable_diffs: disable_diffs disable_diffs: disable_diffs
).deliver ).deliver_now
# These are input errors and won't be corrected even if Sidekiq retries # These are input errors and won't be corrected even if Sidekiq retries
rescue Net::SMTPFatalError, Net::SMTPSyntaxError => e rescue Net::SMTPFatalError, Net::SMTPSyntaxError => e
logger.info("Failed to send e-mail for project '#{project.name_with_namespace}' to #{recipient}: #{e}") logger.info("Failed to send e-mail for project '#{project.name_with_namespace}' to #{recipient}: #{e}")
......
File mode changed from 100644 to 100755
#!/usr/bin/env ruby #!/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_relative '../config/boot'
require 'rails/commands' require 'rails/commands'
#!/usr/bin/env ruby #!/usr/bin/env ruby
begin require_relative '../config/boot'
load File.expand_path("../spring", __FILE__) require 'rake'
rescue LoadError Rake.application.run
end
require 'bundler/setup'
load Gem.bin_path('rake', 'rake')
#!/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
File mode changed from 100644 to 100755
...@@ -99,6 +99,10 @@ module Gitlab ...@@ -99,6 +99,10 @@ module Gitlab
redis_config_hash[:expires_in] = 2.weeks # Cache should not grow forever redis_config_hash[:expires_in] = 2.weeks # Cache should not grow forever
config.cache_store = :redis_store, redis_config_hash 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 # This is needed for gitlab-shell
ENV['GITLAB_PATH_OUTSIDE_HOOK'] = ENV['PATH'] ENV['GITLAB_PATH_OUTSIDE_HOOK'] = ENV['PATH']
end end
......
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
require File.expand_path('../application', __FILE__) require File.expand_path('../application', __FILE__)
# Initialize the rails application # Initialize the rails application
Gitlab::Application.initialize! Rails.application.initialize!
Gitlab::Application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb # Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on # In the development environment your application's code is reloaded on
......
Gitlab::Application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb # Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests # Code is not reloaded between requests
...@@ -9,7 +9,7 @@ Gitlab::Application.configure do ...@@ -9,7 +9,7 @@ Gitlab::Application.configure do
config.action_controller.perform_caching = true config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this) # 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. # Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier config.assets.js_compressor = :uglifier
......
Gitlab::Application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb # Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's # The test environment is used exclusively to run your application's
...@@ -8,7 +8,7 @@ Gitlab::Application.configure do ...@@ -8,7 +8,7 @@ Gitlab::Application.configure do
config.cache_classes = false config.cache_classes = false
# Configure static asset server for tests with Cache-Control for performance # 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" config.static_cache_control = "public, max-age=3600"
# Show full error reports and disable caching # Show full error reports and disable caching
...@@ -32,4 +32,6 @@ Gitlab::Application.configure do ...@@ -32,4 +32,6 @@ Gitlab::Application.configure do
config.eager_load = false config.eager_load = false
config.cache_store = :null_store config.cache_store = :null_store
config.active_job.queue_adapter = :test
end end
# Be sure to restart your server when you modify this file. # 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
...@@ -8,4 +8,4 @@ unless Gitlab.config.gitlab_on_standard_port? ...@@ -8,4 +8,4 @@ unless Gitlab.config.gitlab_on_standard_port?
default_url_options[:port] = Gitlab.config.gitlab.port default_url_options[:port] = Gitlab.config.gitlab.port
end end
Gitlab::Application.routes.default_url_options = default_url_options Rails.application.routes.default_url_options = default_url_options
...@@ -4,13 +4,13 @@ ...@@ -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 # 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 = [ paths_to_be_protected = [
"#{Gitlab::Application.config.relative_url_root}/users/password", "#{Rails.application.config.relative_url_root}/users/password",
"#{Gitlab::Application.config.relative_url_root}/users/sign_in", "#{Rails.application.config.relative_url_root}/users/sign_in",
"#{Gitlab::Application.config.relative_url_root}/api/#{API::API.version}/session.json", "#{Rails.application.config.relative_url_root}/api/#{API::API.version}/session.json",
"#{Gitlab::Application.config.relative_url_root}/api/#{API::API.version}/session", "#{Rails.application.config.relative_url_root}/api/#{API::API.version}/session",
"#{Gitlab::Application.config.relative_url_root}/users", "#{Rails.application.config.relative_url_root}/users",
"#{Gitlab::Application.config.relative_url_root}/users/confirmation", "#{Rails.application.config.relative_url_root}/users/confirmation",
"#{Gitlab::Application.config.relative_url_root}/unsubscribes/" "#{Rails.application.config.relative_url_root}/unsubscribes/"
] ]
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# with darker backgrounds. This patch tweaks the colors a bit so the output is # with darker backgrounds. This patch tweaks the colors a bit so the output is
# actually readable. # actually readable.
if Rails.env.development? and RUBY_ENGINE == 'ruby' and ENV['ENABLE_LINEPROF'] 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 module Rack
class Lineprof class Lineprof
......
...@@ -22,15 +22,15 @@ def find_secure_token ...@@ -22,15 +22,15 @@ def find_secure_token
end end
end end
Gitlab::Application.config.secret_token = find_secure_token Rails.application.config.secret_token = find_secure_token
Gitlab::Application.config.secret_key_base = find_secure_token Rails.application.config.secret_key_base = find_secure_token
# CI # CI
def generate_new_secure_token def generate_new_secure_token
SecureRandom.hex(64) SecureRandom.hex(64)
end 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`" 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') 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? ...@@ -46,5 +46,5 @@ if Gitlab::Application.secrets.db_key_base.blank?
file.write(YAML.dump(all_secrets)) file.write(YAML.dump(all_secrets))
end end
Gitlab::Application.secrets.db_key_base = env_secrets['db_key_base'] Rails.application.secrets.db_key_base = env_secrets['db_key_base']
end end
...@@ -13,11 +13,11 @@ end ...@@ -13,11 +13,11 @@ end
unless Rails.env.test? unless Rails.env.test?
Gitlab::Application.config.session_store( Gitlab::Application.config.session_store(
:redis_store, # Using the cookie_store would enable session replay attacks. :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', key: '_gitlab_session',
secure: Gitlab.config.gitlab.https, secure: Gitlab.config.gitlab.https,
httponly: true, httponly: true,
expire_after: Settings.gitlab['session_expire_delay'] * 60, 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 end
if Gitlab::Sherlock.enabled? if Gitlab::Sherlock.enabled?
Gitlab::Application.configure do |config| Rails.application.configure do |config|
config.middleware.use(Gitlab::Sherlock::Middleware) config.middleware.use(Gitlab::Sherlock::Middleware)
end end
end end
...@@ -8,7 +8,7 @@ ...@@ -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 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? if Rails.env.production?
Gitlab::Application.config.action_mailer.delivery_method = :smtp Rails.application.config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = { ActionMailer::Base.smtp_settings = {
address: "email.server.com", address: "email.server.com",
......
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 # The `ActionDispatch::Static` middleware intercepts requests for static files
# by checking if they exist in the `/public` directory. # by checking if they exist in the `/public` directory.
# We're replacing it with our `Gitlab::Middleware::Static` that does the same, # We're replacing it with our `Gitlab::Middleware::Static` that does the same,
......
require 'sidekiq/web' require 'sidekiq/web'
require 'api/api' require 'api/api'
Gitlab::Application.routes.draw do Rails.application.routes.draw do
if Gitlab::Sherlock.enabled? if Gitlab::Sherlock.enabled?
namespace :sherlock do namespace :sherlock do
resources :transactions, only: [:index, :show] do resources :transactions, only: [:index, :show] do
......
This diff is collapsed.
This diff is collapsed.
...@@ -312,7 +312,7 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da ...@@ -312,7 +312,7 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da
GitLab Shell is an SSH access and repository management software developed specially for GitLab. GitLab Shell is an SSH access and repository management software developed specially for GitLab.
# Run the installation task for gitlab-shell (replace `REDIS_URL` if needed): # Run the installation task for gitlab-shell (replace `REDIS_URL` if needed):
sudo -u git -H bundle exec rake gitlab:shell:install[v2.6.7] REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production sudo -u git -H bundle exec rake gitlab:shell:install REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production
# By default, the gitlab-shell config is generated from your main GitLab config. # By default, the gitlab-shell config is generated from your main GitLab config.
# You can review (and modify) the gitlab-shell config as follows: # You can review (and modify) the gitlab-shell config as follows:
......
...@@ -68,7 +68,7 @@ sudo -u git -H git checkout 8-2-stable-ee ...@@ -68,7 +68,7 @@ sudo -u git -H git checkout 8-2-stable-ee
```bash ```bash
cd /home/git/gitlab-shell cd /home/git/gitlab-shell
sudo -u git -H git fetch sudo -u git -H git fetch
sudo -u git -H git checkout v2.6.7 sudo -u git -H git checkout v2.6.8
``` ```
### 5. Replace gitlab-git-http-server with gitlab-workhorse ### 5. Replace gitlab-git-http-server with gitlab-workhorse
......
...@@ -16,6 +16,17 @@ module Gitlab ...@@ -16,6 +16,17 @@ module Gitlab
def trigger(gl_id, oldrev, newrev, ref) def trigger(gl_id, oldrev, newrev, ref)
return true unless exists? return true unless exists?
case name
when "pre-receive", "post-receive"
call_receive_hook(gl_id, oldrev, newrev, ref)
when "update"
call_update_hook(gl_id, oldrev, newrev, ref)
end
end
private
def call_receive_hook(gl_id, oldrev, newrev, ref)
changes = [oldrev, newrev, ref].join(" ") changes = [oldrev, newrev, ref].join(" ")
# function will return true if succesful # function will return true if succesful
...@@ -54,6 +65,12 @@ module Gitlab ...@@ -54,6 +65,12 @@ module Gitlab
exit_status exit_status
end end
def call_update_hook(gl_id, oldrev, newrev, ref)
Dir.chdir(repo_path) do
system({ 'GL_ID' => gl_id }, path, ref, oldrev, newrev)
end
end
end end
end end
end end
...@@ -46,7 +46,7 @@ module Gitlab ...@@ -46,7 +46,7 @@ module Gitlab
end end
def github_options 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 end
end end
......
...@@ -75,7 +75,7 @@ module Gitlab ...@@ -75,7 +75,7 @@ module Gitlab
end end
def gitlab_options 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 end
end end
......
...@@ -66,8 +66,7 @@ module Gitlab ...@@ -66,8 +66,7 @@ module Gitlab
def url_for_label(project, label) def url_for_label(project, label)
h = Gitlab::Application.routes.url_helpers h = Gitlab::Application.routes.url_helpers
h.namespace_project_issues_path(project.namespace, project, h.namespace_project_issues_path(project.namespace, project,
label_name: label.name, label_name: label.name)
only_path: context[:only_path])
end end
def render_colored_label(label) def render_colored_label(label)
......
...@@ -14,7 +14,7 @@ module Gitlab ...@@ -14,7 +14,7 @@ module Gitlab
def self.mute_mailer def self.mute_mailer
code = <<-eos code = <<-eos
def Notify.delay def Notify.deliver_later
self self
end end
eos eos
......
...@@ -18,6 +18,7 @@ describe AbuseReportsController do ...@@ -18,6 +18,7 @@ describe AbuseReportsController do
end end
it "sends a notification email" do it "sends a notification email" do
perform_enqueued_jobs do
post :create, post :create,
abuse_report: { abuse_report: {
user_id: user.id, user_id: user.id,
...@@ -30,8 +31,10 @@ describe AbuseReportsController do ...@@ -30,8 +31,10 @@ describe AbuseReportsController do
expect(email.subject).to include(user.username) expect(email.subject).to include(user.username)
expect(email.text_part.body).to include(message) expect(email.text_part.body).to include(message)
end end
end
it "saves the abuse report" do it "saves the abuse report" do
perform_enqueued_jobs do
expect do expect do
post :create, post :create,
abuse_report: { abuse_report: {
...@@ -41,6 +44,7 @@ describe AbuseReportsController do ...@@ -41,6 +44,7 @@ describe AbuseReportsController do
end.to change { AbuseReport.count }.by(1) end.to change { AbuseReport.count }.by(1)
end end
end end
end
context "without admin notification email set" do context "without admin notification email set" do
before(:each) do before(:each) do
......
...@@ -69,6 +69,21 @@ describe Projects::CommitController do ...@@ -69,6 +69,21 @@ describe Projects::CommitController do
expect(response.body).to start_with("diff --git") expect(response.body).to start_with("diff --git")
end end
it "should really only be a git diff without whitespace changes" do
get(:show,
namespace_id: project.namespace.to_param,
project_id: project.to_param,
id: '66eceea0db202bb39c4e445e8ca28689645366c5',
# id: commit.id,
format: format,
w: 1)
expect(response.body).to start_with("diff --git")
# without whitespace option, there are more than 2 diff_splits
diff_splits = assigns(:diffs)[0].diff.split("\n")
expect(diff_splits.length).to be <= 2
end
end end
describe "as patch" do describe "as patch" do
......
...@@ -88,6 +88,22 @@ describe ProjectsController do ...@@ -88,6 +88,22 @@ describe ProjectsController do
end end
end end
describe "#destroy" do
let(:admin) { create(:admin) }
it "redirects to the dashboard" do
controller.instance_variable_set(:@project, project)
sign_in(admin)
orig_id = project.id
delete :destroy, namespace_id: project.namespace.path, id: project.path
expect { Project.find(orig_id) }.to raise_error(ActiveRecord::RecordNotFound)
expect(response.status).to eq(302)
expect(response).to redirect_to(dashboard_projects_path)
end
end
describe "POST #toggle_star" do describe "POST #toggle_star" do
it "toggles star if user is signed in" do it "toggles star if user is signed in" do
sign_in(user) sign_in(user)
......
...@@ -87,13 +87,16 @@ describe "Admin::Users", feature: true do ...@@ -87,13 +87,16 @@ describe "Admin::Users", feature: true do
end end
it "should call send mail" do 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" click_button "Create user"
end end
it "should send valid email to user with email & password" do it "should send valid email to user with email & password" do
perform_enqueued_jobs do
click_button "Create user" click_button "Create user"
end
user = User.find_by(username: 'bang') user = User.find_by(username: 'bang')
email = ActionMailer::Base.deliveries.last email = ActionMailer::Base.deliveries.last
expect(email.subject).to have_content('Account was created') expect(email.subject).to have_content('Account was created')
......
...@@ -59,7 +59,7 @@ describe ApplicationHelper do ...@@ -59,7 +59,7 @@ describe ApplicationHelper do
avatar_url = "http://localhost/uploads/project/avatar/#{project.id}/banana_sample.gif" 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). 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 end
it 'should give uploaded icon when present' do it 'should give uploaded icon when present' do
......
...@@ -71,7 +71,7 @@ module Gitlab::Markdown ...@@ -71,7 +71,7 @@ module Gitlab::Markdown
doc = reference_filter("See #{reference}") doc = reference_filter("See #{reference}")
expect(doc.css('a').first.attr('href')).to eq urls. 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 end
it 'links with adjacent text' do it 'links with adjacent text' do
...@@ -94,7 +94,7 @@ module Gitlab::Markdown ...@@ -94,7 +94,7 @@ module Gitlab::Markdown
doc = reference_filter("See #{reference}") doc = reference_filter("See #{reference}")
expect(doc.css('a').first.attr('href')).to eq urls. 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' expect(doc.text).to eq 'See gfm'
end end
...@@ -118,7 +118,7 @@ module Gitlab::Markdown ...@@ -118,7 +118,7 @@ module Gitlab::Markdown
doc = reference_filter("See #{reference}") doc = reference_filter("See #{reference}")
expect(doc.css('a').first.attr('href')).to eq urls. 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' expect(doc.text).to eq 'See gfm references'
end end
......
...@@ -44,13 +44,10 @@ describe Ci::MailService do ...@@ -44,13 +44,10 @@ describe Ci::MailService do
end end
it do it do
should_email("git@example.com") perform_enqueued_jobs do
mail.execute(build) 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
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)
end end
end end
...@@ -67,13 +64,10 @@ describe Ci::MailService do ...@@ -67,13 +64,10 @@ describe Ci::MailService do
end end
it do it do
should_email("git@example.com") perform_enqueued_jobs do
mail.execute(build) 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
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)
end end
end end
...@@ -95,14 +89,12 @@ describe Ci::MailService do ...@@ -95,14 +89,12 @@ describe Ci::MailService do
end end
it do it do
should_email("git@example.com") perform_enqueued_jobs do
should_email("jeroen@example.com") expect{ mail.execute(build) }.to change{ ActionMailer::Base.deliveries.size }.by(2)
mail.execute(build) expect(
ActionMailer::Base.deliveries.map(&:to).flatten
).to include("git@example.com", "jeroen@example.com")
end 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)
end end
end end
...@@ -124,14 +116,11 @@ describe Ci::MailService do ...@@ -124,14 +116,11 @@ describe Ci::MailService do
end end
it do it do
should_email(commit.git_author_email) perform_enqueued_jobs do
should_email("jeroen@example.com") expect do
mail.execute(build) if mail.can_execute?(build) mail.execute(build) if mail.can_execute?(build)
end.to_not change{ ActionMailer::Base.deliveries.size }
end 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)
end end
end end
...@@ -177,14 +166,11 @@ describe Ci::MailService do ...@@ -177,14 +166,11 @@ describe Ci::MailService do
it do it do
Ci::Build.retry(build) Ci::Build.retry(build)
should_email(commit.git_author_email) perform_enqueued_jobs do
should_email("jeroen@example.com") expect do
mail.execute(build) if mail.can_execute?(build) mail.execute(build) if mail.can_execute?(build)
end.to_not change{ ActionMailer::Base.deliveries.size }
end 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)
end end
end end
end end
......
...@@ -94,9 +94,9 @@ describe JiraService do ...@@ -94,9 +94,9 @@ describe JiraService do
end end
it 'should be prepopulated with the settings' do it 'should be prepopulated with the settings' do
expect(@service.properties[:project_url]).to eq('http://jira.sample/projects/project_a') 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["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["new_issue_url"]).to eq("http://jira.sample/projects/project_a/issues/new")
end end
end end
end end
......
...@@ -14,8 +14,10 @@ describe Issues::CloseService do ...@@ -14,8 +14,10 @@ describe Issues::CloseService do
describe :execute do describe :execute do
context "valid params" do context "valid params" do
before do before do
perform_enqueued_jobs do
@issue = Issues::CloseService.new(project, user, {}).execute(issue) @issue = Issues::CloseService.new(project, user, {}).execute(issue)
end end
end
it { expect(@issue).to be_valid } it { expect(@issue).to be_valid }
it { expect(@issue).to be_closed } it { expect(@issue).to be_closed }
......
...@@ -36,7 +36,10 @@ describe Issues::UpdateService do ...@@ -36,7 +36,10 @@ describe Issues::UpdateService do
label_ids: [label.id] label_ids: [label.id]
} }
perform_enqueued_jobs do
@issue = Issues::UpdateService.new(project, user, opts).execute(issue) @issue = Issues::UpdateService.new(project, user, opts).execute(issue)
end
@issue.reload @issue.reload
end end
......
...@@ -18,8 +18,10 @@ describe MergeRequests::CloseService do ...@@ -18,8 +18,10 @@ describe MergeRequests::CloseService do
before do before do
allow(service).to receive(:execute_hooks) allow(service).to receive(:execute_hooks)
perform_enqueued_jobs do
@merge_request = service.execute(merge_request) @merge_request = service.execute(merge_request)
end end
end
it { expect(@merge_request).to be_valid } it { expect(@merge_request).to be_valid }
it { expect(@merge_request).to be_closed } it { expect(@merge_request).to be_closed }
......
...@@ -17,9 +17,10 @@ describe MergeRequests::MergeService do ...@@ -17,9 +17,10 @@ describe MergeRequests::MergeService do
before do before do
allow(service).to receive(:execute_hooks) allow(service).to receive(:execute_hooks)
perform_enqueued_jobs do
service.execute(merge_request, 'Awesome message') service.execute(merge_request, 'Awesome message')
end end
end
it { expect(merge_request).to be_valid } it { expect(merge_request).to be_valid }
it { expect(merge_request).to be_merged } it { expect(merge_request).to be_merged }
......
...@@ -19,8 +19,10 @@ describe MergeRequests::ReopenService do ...@@ -19,8 +19,10 @@ describe MergeRequests::ReopenService do
allow(service).to receive(:execute_hooks) allow(service).to receive(:execute_hooks)
merge_request.state = :closed merge_request.state = :closed
perform_enqueued_jobs do
service.execute(merge_request) service.execute(merge_request)
end end
end
it { expect(merge_request).to be_valid } it { expect(merge_request).to be_valid }
it { expect(merge_request).to be_reopened } it { expect(merge_request).to be_reopened }
......
...@@ -42,9 +42,11 @@ describe MergeRequests::UpdateService do ...@@ -42,9 +42,11 @@ describe MergeRequests::UpdateService do
before do before do
allow(service).to receive(:execute_hooks) allow(service).to receive(:execute_hooks)
perform_enqueued_jobs do
@merge_request = service.execute(merge_request) @merge_request = service.execute(merge_request)
@merge_request.reload @merge_request.reload
end end
end
it { expect(@merge_request).to be_valid } it { expect(@merge_request).to be_valid }
it { expect(@merge_request.title).to eq('New title') } it { expect(@merge_request.title).to eq('New title') }
......
This diff is collapsed.
...@@ -31,6 +31,7 @@ RSpec.configure do |config| ...@@ -31,6 +31,7 @@ RSpec.configure do |config|
config.include StubConfiguration config.include StubConfiguration
config.include RelativeUrl, type: feature config.include RelativeUrl, type: feature
config.include TestEnv config.include TestEnv
config.include ActiveJob::TestHelper
config.include StubGitlabCalls config.include StubGitlabCalls
config.include StubGitlabData config.include StubGitlabData
config.include BenchmarkMatchers, benchmark: true config.include BenchmarkMatchers, benchmark: true
......
...@@ -21,6 +21,7 @@ describe EmailReceiverWorker do ...@@ -21,6 +21,7 @@ describe EmailReceiverWorker do
end end
it "sends out a rejection email" do it "sends out a rejection email" do
perform_enqueued_jobs do
described_class.new.perform(raw_message) described_class.new.perform(raw_message)
email = ActionMailer::Base.deliveries.last email = ActionMailer::Base.deliveries.last
...@@ -30,6 +31,7 @@ describe EmailReceiverWorker do ...@@ -30,6 +31,7 @@ describe EmailReceiverWorker do
end end
end end
end end
end
context "when reply by email is disabled" do context "when reply by email is disabled" do
before do before do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment