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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
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
Hide 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
github-markup (~> 1.3.3)
gollum-grit_adapter (~> 1.0)
nokogiri (~> 1.6.4)
rouge (~> 1.
7.4
)
rouge (~> 1.
10.1
)
sanitize (~> 2.1.0)
stringex (~> 2.5.1)
gon (6.0.1)
...
...
@@ -610,7 +610,7 @@ GEM
netrc (~> 0.7)
rinku (1.7.3)
rotp (2.1.1)
rouge (1.
7.7
)
rouge (1.
10.1
)
rqrcode (0.7.0)
chunky_png
rqrcode-rails3 (0.1.7)
...
...
app/controllers/abuse_reports_controller.rb
View file @
e92ceb7b
...
...
@@ -10,7 +10,7 @@ class AbuseReportsController < ApplicationController
if
@abuse_report
.
save
if
current_application_settings
.
admin_notification_email
.
present?
AbuseReportMailer
.
deliver_later
.
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."
...
...
app/models/project_services/ci/mail_service.rb
View file @
e92ceb7b
...
...
@@ -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
.
deliver_later
Ci
::
Notify
end
end
end
app/views/ci/admin/runners/show.html.haml
View file @
e92ceb7b
...
...
@@ -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'
...
...
app/views/ci/notify/build_success_email.html.haml
View file @
e92ceb7b
...
...
@@ -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
...
...
app/views/projects/edit.html.haml
View file @
e92ceb7b
...
...
@@ -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
...
...
app/views/projects/runners/edit.html.haml
View file @
e92ceb7b
...
...
@@ -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'
app/workers/email_receiver_worker.rb
View file @
e92ceb7b
...
...
@@ -46,6 +46,6 @@ class EmailReceiverWorker
return
end
EmailRejectionMailer
.
deliver_later
.
rejection
(
reason
,
raw
,
can_retry
)
EmailRejectionMailer
.
rejection
(
reason
,
raw
,
can_retry
).
deliver_later
end
end
lib/gitlab/github_import/client.rb
View file @
e92ceb7b
...
...
@@ -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
...
...
lib/gitlab/gitlab_import/client.rb
View file @
e92ceb7b
...
...
@@ -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
...
...
spec/controllers/abuse_reports_controller_spec.rb
View file @
e92ceb7b
...
...
@@ -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
...
...
spec/features/admin/admin_users_spec.rb
View file @
e92ceb7b
...
...
@@ -87,7 +87,7 @@ 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
...
...
spec/helpers/application_helper_spec.rb
View file @
e92ceb7b
...
...
@@ -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
...
...
spec/lib/gitlab/markdown/label_reference_filter_spec.rb
View file @
e92ceb7b
...
...
@@ -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
...
...
spec/models/ci/project_services/mail_service_spec.rb
View file @
e92ceb7b
...
...
@@ -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
...
...
spec/models/project_services/jira_service_spec.rb
View file @
e92ceb7b
...
...
@@ -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
...
...
spec/workers/email_receiver_worker_spec.rb
View file @
e92ceb7b
...
...
@@ -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
...
...
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