Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
e92ceb7b
Commit
e92ceb7b
authored
Nov 30, 2015
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix specs
parent
461731f0
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
73 additions
and
81 deletions
+73
-81
Gemfile.lock
Gemfile.lock
+2
-2
app/controllers/abuse_reports_controller.rb
app/controllers/abuse_reports_controller.rb
+1
-1
app/models/project_services/ci/mail_service.rb
app/models/project_services/ci/mail_service.rb
+3
-3
app/views/ci/admin/runners/show.html.haml
app/views/ci/admin/runners/show.html.haml
+1
-1
app/views/ci/notify/build_success_email.html.haml
app/views/ci/notify/build_success_email.html.haml
+1
-1
app/views/projects/edit.html.haml
app/views/projects/edit.html.haml
+1
-1
app/views/projects/runners/edit.html.haml
app/views/projects/runners/edit.html.haml
+1
-1
app/workers/email_receiver_worker.rb
app/workers/email_receiver_worker.rb
+1
-1
lib/gitlab/github_import/client.rb
lib/gitlab/github_import/client.rb
+1
-1
lib/gitlab/gitlab_import/client.rb
lib/gitlab/gitlab_import/client.rb
+1
-1
spec/controllers/abuse_reports_controller_spec.rb
spec/controllers/abuse_reports_controller_spec.rb
+20
-16
spec/features/admin/admin_users_spec.rb
spec/features/admin/admin_users_spec.rb
+1
-1
spec/helpers/application_helper_spec.rb
spec/helpers/application_helper_spec.rb
+1
-1
spec/lib/gitlab/markdown/label_reference_filter_spec.rb
spec/lib/gitlab/markdown/label_reference_filter_spec.rb
+3
-3
spec/models/ci/project_services/mail_service_spec.rb
spec/models/ci/project_services/mail_service_spec.rb
+24
-38
spec/models/project_services/jira_service_spec.rb
spec/models/project_services/jira_service_spec.rb
+3
-3
spec/workers/email_receiver_worker_spec.rb
spec/workers/email_receiver_worker_spec.rb
+8
-6
No files found.
Gemfile.lock
View file @
e92ceb7b
...
@@ -332,7 +332,7 @@ GEM
...
@@ -332,7 +332,7 @@ GEM
github-markup (~> 1.3.3)
github-markup (~> 1.3.3)
gollum-grit_adapter (~> 1.0)
gollum-grit_adapter (~> 1.0)
nokogiri (~> 1.6.4)
nokogiri (~> 1.6.4)
rouge (~> 1.
7.4
)
rouge (~> 1.
10.1
)
sanitize (~> 2.1.0)
sanitize (~> 2.1.0)
stringex (~> 2.5.1)
stringex (~> 2.5.1)
gon (6.0.1)
gon (6.0.1)
...
@@ -610,7 +610,7 @@ GEM
...
@@ -610,7 +610,7 @@ GEM
netrc (~> 0.7)
netrc (~> 0.7)
rinku (1.7.3)
rinku (1.7.3)
rotp (2.1.1)
rotp (2.1.1)
rouge (1.
7.7
)
rouge (1.
10.1
)
rqrcode (0.7.0)
rqrcode (0.7.0)
chunky_png
chunky_png
rqrcode-rails3 (0.1.7)
rqrcode-rails3 (0.1.7)
...
...
app/controllers/abuse_reports_controller.rb
View file @
e92ceb7b
...
@@ -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
.
deliver_later
.
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."
...
...
app/models/project_services/ci/mail_service.rb
View file @
e92ceb7b
...
@@ -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
.
deliver_later
Ci
::
Notify
end
end
end
end
end
end
app/views/ci/admin/runners/show.html.haml
View file @
e92ceb7b
...
@@ -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'
...
...
app/views/ci/notify/build_success_email.html.haml
View file @
e92ceb7b
...
@@ -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
...
...
app/views/projects/edit.html.haml
View file @
e92ceb7b
...
@@ -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
...
...
app/views/projects/runners/edit.html.haml
View file @
e92ceb7b
...
@@ -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'
app/workers/email_receiver_worker.rb
View file @
e92ceb7b
...
@@ -46,6 +46,6 @@ class EmailReceiverWorker
...
@@ -46,6 +46,6 @@ class EmailReceiverWorker
return
return
end
end
EmailRejectionMailer
.
deliver_later
.
rejection
(
reason
,
raw
,
can_retry
)
EmailRejectionMailer
.
rejection
(
reason
,
raw
,
can_retry
).
deliver_later
end
end
end
end
lib/gitlab/github_import/client.rb
View file @
e92ceb7b
...
@@ -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
...
...
lib/gitlab/gitlab_import/client.rb
View file @
e92ceb7b
...
@@ -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
...
...
spec/controllers/abuse_reports_controller_spec.rb
View file @
e92ceb7b
...
@@ -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
...
...
spec/features/admin/admin_users_spec.rb
View file @
e92ceb7b
...
@@ -87,7 +87,7 @@ describe "Admin::Users", feature: true do
...
@@ -87,7 +87,7 @@ 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
...
...
spec/helpers/application_helper_spec.rb
View file @
e92ceb7b
...
@@ -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
...
...
spec/lib/gitlab/markdown/label_reference_filter_spec.rb
View file @
e92ceb7b
...
@@ -71,7 +71,7 @@ module Gitlab::Markdown
...
@@ -71,7 +71,7 @@ module Gitlab::Markdown
doc
=
filter
(
"See
#{
reference
}
"
)
doc
=
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
=
filter
(
"See
#{
reference
}
"
)
doc
=
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
=
filter
(
"See
#{
reference
}
"
)
doc
=
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
...
...
spec/models/ci/project_services/mail_service_spec.rb
View file @
e92ceb7b
...
@@ -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
...
...
spec/models/project_services/jira_service_spec.rb
View file @
e92ceb7b
...
@@ -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
...
...
spec/workers/email_receiver_worker_spec.rb
View file @
e92ceb7b
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment