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
Léo-Paul Géneau
gitlab-ce
Commits
9773ccc4
Commit
9773ccc4
authored
Jan 09, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sidekiq with green tests
parent
71bd9568
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
48 additions
and
68 deletions
+48
-68
Procfile
Procfile
+1
-1
config/initializers/4_sidekiq.rb
config/initializers/4_sidekiq.rb
+0
-0
features/steps/admin/admin_active_tab.rb
features/steps/admin/admin_active_tab.rb
+1
-1
features/support/env.rb
features/support/env.rb
+2
-0
lib/hooks/post-receive
lib/hooks/post-receive
+1
-0
lib/tasks/gitlab/check.rake
lib/tasks/gitlab/check.rake
+3
-3
spec/models/system_hook_spec.rb
spec/models/system_hook_spec.rb
+6
-19
spec/observers/issue_observer_spec.rb
spec/observers/issue_observer_spec.rb
+8
-8
spec/observers/merge_request_observer_spec.rb
spec/observers/merge_request_observer_spec.rb
+2
-5
spec/observers/note_observer_spec.rb
spec/observers/note_observer_spec.rb
+13
-10
spec/observers/user_observer_spec.rb
spec/observers/user_observer_spec.rb
+3
-13
spec/requests/admin/admin_users_spec.rb
spec/requests/admin/admin_users_spec.rb
+2
-4
spec/spec_helper.rb
spec/spec_helper.rb
+2
-0
spec/workers/post_receive_spec.rb
spec/workers/post_receive_spec.rb
+4
-4
No files found.
Procfile
View file @
9773ccc4
web: bundle exec rails s -p $PORT
web: bundle exec rails s -p $PORT
worker: bundle exec
rake sidekiq:star
t
worker: bundle exec
sidekiq -q post_receive,mailer,system_hook,common,defaul
t
config/initializers/4_
resque
.rb
→
config/initializers/4_
sidekiq
.rb
View file @
9773ccc4
File moved
features/steps/admin/admin_active_tab.rb
View file @
9773ccc4
...
@@ -28,6 +28,6 @@ class AdminActiveTab < Spinach::FeatureSteps
...
@@ -28,6 +28,6 @@ class AdminActiveTab < Spinach::FeatureSteps
end
end
Then
'the active main tab should be Resque'
do
Then
'the active main tab should be Resque'
do
ensure_active_main_tab
(
'
Resque
'
)
ensure_active_main_tab
(
'
Background Jobs
'
)
end
end
end
end
features/support/env.rb
View file @
9773ccc4
...
@@ -6,6 +6,8 @@ require './config/environment'
...
@@ -6,6 +6,8 @@ require './config/environment'
require
'rspec'
require
'rspec'
require
'database_cleaner'
require
'database_cleaner'
require
'spinach/capybara'
require
'spinach/capybara'
require
'sidekiq/testing/inline'
%w(gitolite_stub stubbed_repository valid_commit)
.
each
do
|
f
|
%w(gitolite_stub stubbed_repository valid_commit)
.
each
do
|
f
|
require
Rails
.
root
.
join
(
'spec'
,
'support'
,
f
)
require
Rails
.
root
.
join
(
'spec'
,
'support'
,
f
)
...
...
lib/hooks/post-receive
View file @
9773ccc4
#!/usr/bin/env bash
#!/usr/bin/env bash
# Version 4.1
# This file was placed here by GitLab. It makes sure that your pushed commits
# This file was placed here by GitLab. It makes sure that your pushed commits
# will be processed properly.
# will be processed properly.
...
...
lib/tasks/gitlab/check.rake
View file @
9773ccc4
...
@@ -871,7 +871,7 @@ namespace :gitlab do
...
@@ -871,7 +871,7 @@ namespace :gitlab do
namespace
:resque
do
namespace
:resque
do
desc
"GITLAB | Check the configuration of
Resque
"
desc
"GITLAB | Check the configuration of
Sidekiq
"
task
check: :environment
do
task
check: :environment
do
warn_user_is_not_gitlab
warn_user_is_not_gitlab
start_checking
"Resque"
start_checking
"Resque"
...
@@ -888,7 +888,7 @@ namespace :gitlab do
...
@@ -888,7 +888,7 @@ namespace :gitlab do
def
check_resque_running
def
check_resque_running
print
"Running? ... "
print
"Running? ... "
if
run_and_match
(
"ps aux | grep -i
resque"
,
/resque
-[\d\.]+:.+$/
)
if
run_and_match
(
"ps aux | grep -i
sidekiq"
,
/sidekiq
-[\d\.]+:.+$/
)
puts
"yes"
.
green
puts
"yes"
.
green
else
else
puts
"no"
.
red
puts
"no"
.
red
...
@@ -899,7 +899,7 @@ namespace :gitlab do
...
@@ -899,7 +899,7 @@ namespace :gitlab do
)
)
for_more_information
(
for_more_information
(
see_installation_guide_section
(
"Install Init Script"
),
see_installation_guide_section
(
"Install Init Script"
),
"see log/
resque
.log for possible errors"
"see log/
sidekiq
.log for possible errors"
)
)
fix_and_rerun
fix_and_rerun
end
end
...
...
spec/models/system_hook_spec.rb
View file @
9773ccc4
...
@@ -23,41 +23,31 @@ describe SystemHook do
...
@@ -23,41 +23,31 @@ describe SystemHook do
end
end
it
"project_create hook"
do
it
"project_create hook"
do
with_resque
do
project
=
create
(
:project
)
project
=
create
(
:project
)
end
WebMock
.
should
have_requested
(
:post
,
@system_hook
.
url
).
with
(
body:
/project_create/
).
once
WebMock
.
should
have_requested
(
:post
,
@system_hook
.
url
).
with
(
body:
/project_create/
).
once
end
end
it
"project_destroy hook"
do
it
"project_destroy hook"
do
project
=
create
(
:project
)
project
=
create
(
:project
)
with_resque
do
project
.
destroy
project
.
destroy
end
WebMock
.
should
have_requested
(
:post
,
@system_hook
.
url
).
with
(
body:
/project_destroy/
).
once
WebMock
.
should
have_requested
(
:post
,
@system_hook
.
url
).
with
(
body:
/project_destroy/
).
once
end
end
it
"user_create hook"
do
it
"user_create hook"
do
with_resque
do
create
(
:user
)
create
(
:user
)
end
WebMock
.
should
have_requested
(
:post
,
@system_hook
.
url
).
with
(
body:
/user_create/
).
once
WebMock
.
should
have_requested
(
:post
,
@system_hook
.
url
).
with
(
body:
/user_create/
).
once
end
end
it
"user_destroy hook"
do
it
"user_destroy hook"
do
user
=
create
(
:user
)
user
=
create
(
:user
)
with_resque
do
user
.
destroy
user
.
destroy
end
WebMock
.
should
have_requested
(
:post
,
@system_hook
.
url
).
with
(
body:
/user_destroy/
).
once
WebMock
.
should
have_requested
(
:post
,
@system_hook
.
url
).
with
(
body:
/user_destroy/
).
once
end
end
it
"project_create hook"
do
it
"project_create hook"
do
user
=
create
(
:user
)
user
=
create
(
:user
)
project
=
create
(
:project
)
project
=
create
(
:project
)
with_resque
do
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user
,
:master
]
end
WebMock
.
should
have_requested
(
:post
,
@system_hook
.
url
).
with
(
body:
/user_add_to_team/
).
once
WebMock
.
should
have_requested
(
:post
,
@system_hook
.
url
).
with
(
body:
/user_add_to_team/
).
once
end
end
...
@@ -65,11 +55,8 @@ describe SystemHook do
...
@@ -65,11 +55,8 @@ describe SystemHook do
user
=
create
(
:user
)
user
=
create
(
:user
)
project
=
create
(
:project
)
project
=
create
(
:project
)
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user
,
:master
]
with_resque
do
project
.
users_projects
.
clear
project
.
users_projects
.
clear
end
WebMock
.
should
have_requested
(
:post
,
@system_hook
.
url
).
with
(
body:
/user_remove_from_team/
).
once
WebMock
.
should
have_requested
(
:post
,
@system_hook
.
url
).
with
(
body:
/user_remove_from_team/
).
once
end
end
end
end
end
end
spec/observers/issue_observer_spec.rb
View file @
9773ccc4
...
@@ -21,8 +21,7 @@ describe IssueObserver do
...
@@ -21,8 +21,7 @@ describe IssueObserver do
end
end
it
'sends an email to the assignee'
do
it
'sends an email to the assignee'
do
Notify
.
should_receive
(
:new_issue_email
).
with
(
issue
.
id
).
Notify
.
should_receive
(
:new_issue_email
).
with
(
issue
.
id
)
and_return
(
double
(
deliver:
true
))
subject
.
after_create
(
issue
)
subject
.
after_create
(
issue
)
end
end
...
@@ -71,6 +70,7 @@ describe IssueObserver do
...
@@ -71,6 +70,7 @@ describe IssueObserver do
context
'a status "closed"'
do
context
'a status "closed"'
do
it
'note is created if the issue is being closed'
do
it
'note is created if the issue is being closed'
do
issue
.
should_receive
(
:is_being_closed?
).
and_return
(
true
)
issue
.
should_receive
(
:is_being_closed?
).
and_return
(
true
)
Notify
.
should_receive
(
:issue_status_changed_email
).
twice
Note
.
should_receive
(
:create_status_change_note
).
with
(
issue
,
some_user
,
'closed'
)
Note
.
should_receive
(
:create_status_change_note
).
with
(
issue
,
some_user
,
'closed'
)
subject
.
after_update
(
issue
)
subject
.
after_update
(
issue
)
...
@@ -85,7 +85,7 @@ describe IssueObserver do
...
@@ -85,7 +85,7 @@ describe IssueObserver do
it
'notification is delivered if the issue being closed'
do
it
'notification is delivered if the issue being closed'
do
issue
.
stub
(
:is_being_closed?
).
and_return
(
true
)
issue
.
stub
(
:is_being_closed?
).
and_return
(
true
)
Notify
.
should_receive
(
:issue_status_changed_email
).
twice
.
and_return
(
stub
(
deliver:
true
))
Notify
.
should_receive
(
:issue_status_changed_email
).
twice
Note
.
should_receive
(
:create_status_change_note
).
with
(
issue
,
some_user
,
'closed'
)
Note
.
should_receive
(
:create_status_change_note
).
with
(
issue
,
some_user
,
'closed'
)
subject
.
after_update
(
issue
)
subject
.
after_update
(
issue
)
...
@@ -104,7 +104,7 @@ describe IssueObserver do
...
@@ -104,7 +104,7 @@ describe IssueObserver do
issue_without_assignee
.
stub
(
:is_being_reassigned?
).
and_return
(
false
)
issue_without_assignee
.
stub
(
:is_being_reassigned?
).
and_return
(
false
)
issue_without_assignee
.
stub
(
:is_being_closed?
).
and_return
(
true
)
issue_without_assignee
.
stub
(
:is_being_closed?
).
and_return
(
true
)
issue_without_assignee
.
stub
(
:is_being_reopened?
).
and_return
(
false
)
issue_without_assignee
.
stub
(
:is_being_reopened?
).
and_return
(
false
)
Notify
.
should_receive
(
:issue_status_changed_email
).
once
.
and_return
(
stub
(
deliver:
true
))
Notify
.
should_receive
(
:issue_status_changed_email
).
once
Note
.
should_receive
(
:create_status_change_note
).
with
(
issue_without_assignee
,
some_user
,
'closed'
)
Note
.
should_receive
(
:create_status_change_note
).
with
(
issue_without_assignee
,
some_user
,
'closed'
)
subject
.
after_update
(
issue_without_assignee
)
subject
.
after_update
(
issue_without_assignee
)
...
@@ -113,6 +113,7 @@ describe IssueObserver do
...
@@ -113,6 +113,7 @@ describe IssueObserver do
context
'a status "reopened"'
do
context
'a status "reopened"'
do
it
'note is created if the issue is being reopened'
do
it
'note is created if the issue is being reopened'
do
Notify
.
should_receive
(
:issue_status_changed_email
).
twice
issue
.
should_receive
(
:is_being_reopened?
).
and_return
(
true
)
issue
.
should_receive
(
:is_being_reopened?
).
and_return
(
true
)
Note
.
should_receive
(
:create_status_change_note
).
with
(
issue
,
some_user
,
'reopened'
)
Note
.
should_receive
(
:create_status_change_note
).
with
(
issue
,
some_user
,
'reopened'
)
...
@@ -128,7 +129,7 @@ describe IssueObserver do
...
@@ -128,7 +129,7 @@ describe IssueObserver do
it
'notification is delivered if the issue being reopened'
do
it
'notification is delivered if the issue being reopened'
do
issue
.
stub
(
:is_being_reopened?
).
and_return
(
true
)
issue
.
stub
(
:is_being_reopened?
).
and_return
(
true
)
Notify
.
should_receive
(
:issue_status_changed_email
).
twice
.
and_return
(
stub
(
deliver:
true
))
Notify
.
should_receive
(
:issue_status_changed_email
).
twice
Note
.
should_receive
(
:create_status_change_note
).
with
(
issue
,
some_user
,
'reopened'
)
Note
.
should_receive
(
:create_status_change_note
).
with
(
issue
,
some_user
,
'reopened'
)
subject
.
after_update
(
issue
)
subject
.
after_update
(
issue
)
...
@@ -147,7 +148,7 @@ describe IssueObserver do
...
@@ -147,7 +148,7 @@ describe IssueObserver do
issue_without_assignee
.
stub
(
:is_being_reassigned?
).
and_return
(
false
)
issue_without_assignee
.
stub
(
:is_being_reassigned?
).
and_return
(
false
)
issue_without_assignee
.
stub
(
:is_being_closed?
).
and_return
(
false
)
issue_without_assignee
.
stub
(
:is_being_closed?
).
and_return
(
false
)
issue_without_assignee
.
stub
(
:is_being_reopened?
).
and_return
(
true
)
issue_without_assignee
.
stub
(
:is_being_reopened?
).
and_return
(
true
)
Notify
.
should_receive
(
:issue_status_changed_email
).
once
.
and_return
(
stub
(
deliver:
true
))
Notify
.
should_receive
(
:issue_status_changed_email
).
once
Note
.
should_receive
(
:create_status_change_note
).
with
(
issue_without_assignee
,
some_user
,
'reopened'
)
Note
.
should_receive
(
:create_status_change_note
).
with
(
issue_without_assignee
,
some_user
,
'reopened'
)
subject
.
after_update
(
issue_without_assignee
)
subject
.
after_update
(
issue_without_assignee
)
...
@@ -164,8 +165,7 @@ describe IssueObserver do
...
@@ -164,8 +165,7 @@ describe IssueObserver do
end
end
def
it_sends_a_reassigned_email_to
(
recipient
)
def
it_sends_a_reassigned_email_to
(
recipient
)
Notify
.
should_receive
(
:reassigned_issue_email
).
with
(
recipient
,
issue
.
id
,
previous_assignee
.
id
).
Notify
.
should_receive
(
:reassigned_issue_email
).
with
(
recipient
,
issue
.
id
,
previous_assignee
.
id
)
and_return
(
double
(
deliver:
true
))
end
end
def
it_does_not_send_a_reassigned_email_to
(
recipient
)
def
it_does_not_send_a_reassigned_email_to
(
recipient
)
...
...
spec/observers/merge_request_observer_spec.rb
View file @
9773ccc4
...
@@ -21,9 +21,7 @@ describe MergeRequestObserver do
...
@@ -21,9 +21,7 @@ describe MergeRequestObserver do
end
end
it
'sends an email to the assignee'
do
it
'sends an email to the assignee'
do
Notify
.
should_receive
(
:new_merge_request_email
).
with
(
mr
.
id
).
Notify
.
should_receive
(
:new_merge_request_email
).
with
(
mr
.
id
)
and_return
(
double
(
deliver:
true
))
subject
.
after_create
(
mr
)
subject
.
after_create
(
mr
)
end
end
...
@@ -158,8 +156,7 @@ describe MergeRequestObserver do
...
@@ -158,8 +156,7 @@ describe MergeRequestObserver do
end
end
def
it_sends_a_reassigned_email_to
(
recipient
)
def
it_sends_a_reassigned_email_to
(
recipient
)
Notify
.
should_receive
(
:reassigned_merge_request_email
).
with
(
recipient
,
mr
.
id
,
previous_assignee
.
id
).
Notify
.
should_receive
(
:reassigned_merge_request_email
).
with
(
recipient
,
mr
.
id
,
previous_assignee
.
id
)
and_return
(
double
(
deliver:
true
))
end
end
def
it_does_not_send_a_reassigned_email_to
(
recipient
)
def
it_does_not_send_a_reassigned_email_to
(
recipient
)
...
...
spec/observers/note_observer_spec.rb
View file @
9773ccc4
...
@@ -4,7 +4,6 @@ describe NoteObserver do
...
@@ -4,7 +4,6 @@ describe NoteObserver do
subject
{
NoteObserver
.
instance
}
subject
{
NoteObserver
.
instance
}
let
(
:team_without_author
)
{
(
1
..
2
).
map
{
|
n
|
double
:user
,
id:
n
}
}
let
(
:team_without_author
)
{
(
1
..
2
).
map
{
|
n
|
double
:user
,
id:
n
}
}
let
(
:delivery_success
)
{
double
deliver:
true
}
describe
'#after_create'
do
describe
'#after_create'
do
let
(
:note
)
{
double
:note
}
let
(
:note
)
{
double
:note
}
...
@@ -45,13 +44,13 @@ describe NoteObserver do
...
@@ -45,13 +44,13 @@ describe NoteObserver do
note
.
stub
(
:id
).
and_return
(
42
)
note
.
stub
(
:id
).
and_return
(
42
)
author
=
double
:user
,
id:
1
author
=
double
:user
,
id:
1
note
.
stub
(
:commit_author
).
and_return
(
author
)
note
.
stub
(
:commit_author
).
and_return
(
author
)
Notify
.
should_receive
(
:note_commit_email
)
.
and_return
(
delivery_success
)
Notify
.
should_receive
(
:note_commit_email
)
subject
.
after_create
(
note
)
subject
.
after_create
(
note
)
end
end
it
'does not notify the author of a commit when not flagged to notify the author'
do
it
'does not notify the author of a commit when not flagged to notify the author'
do
N
otify
.
should_not_receive
(
:note_commit_email
)
n
otify
.
should_not_receive
(
:note_commit_email
)
subject
.
after_create
(
note
)
subject
.
after_create
(
note
)
end
end
...
@@ -71,28 +70,28 @@ describe NoteObserver do
...
@@ -71,28 +70,28 @@ describe NoteObserver do
context
'notifies team of a new note on'
do
context
'notifies team of a new note on'
do
it
'a commit'
do
it
'a commit'
do
note
.
stub
(
:noteable_type
).
and_return
(
'Commit'
)
note
.
stub
(
:noteable_type
).
and_return
(
'Commit'
)
Notify
.
should_receive
(
:note_commit_email
).
twice
.
and_return
(
delivery_success
)
notify
.
should_receive
(
:note_commit_email
).
twice
subject
.
send
(
:notify_team
,
note
)
subject
.
send
(
:notify_team
,
note
)
end
end
it
'an issue'
do
it
'an issue'
do
note
.
stub
(
:noteable_type
).
and_return
(
'Issue'
)
note
.
stub
(
:noteable_type
).
and_return
(
'Issue'
)
Notify
.
should_receive
(
:note_issue_email
).
twice
.
and_return
(
delivery_success
)
notify
.
should_receive
(
:note_issue_email
).
twice
subject
.
send
(
:notify_team
,
note
)
subject
.
send
(
:notify_team
,
note
)
end
end
it
'a wiki page'
do
it
'a wiki page'
do
note
.
stub
(
:noteable_type
).
and_return
(
'Wiki'
)
note
.
stub
(
:noteable_type
).
and_return
(
'Wiki'
)
Notify
.
should_receive
(
:note_wiki_email
).
twice
.
and_return
(
delivery_success
)
notify
.
should_receive
(
:note_wiki_email
).
twice
subject
.
send
(
:notify_team
,
note
)
subject
.
send
(
:notify_team
,
note
)
end
end
it
'a merge request'
do
it
'a merge request'
do
note
.
stub
(
:noteable_type
).
and_return
(
'MergeRequest'
)
note
.
stub
(
:noteable_type
).
and_return
(
'MergeRequest'
)
Notify
.
should_receive
(
:note_merge_request_email
).
twice
.
and_return
(
delivery_success
)
notify
.
should_receive
(
:note_merge_request_email
).
twice
subject
.
send
(
:notify_team
,
note
)
subject
.
send
(
:notify_team
,
note
)
end
end
...
@@ -100,7 +99,7 @@ describe NoteObserver do
...
@@ -100,7 +99,7 @@ describe NoteObserver do
it
'a wall'
do
it
'a wall'
do
# Note: wall posts have #noteable_type of nil
# Note: wall posts have #noteable_type of nil
note
.
stub
(
:noteable_type
).
and_return
(
nil
)
note
.
stub
(
:noteable_type
).
and_return
(
nil
)
Notify
.
should_receive
(
:note_wall_email
).
twice
.
and_return
(
delivery_success
)
notify
.
should_receive
(
:note_wall_email
).
twice
subject
.
send
(
:notify_team
,
note
)
subject
.
send
(
:notify_team
,
note
)
end
end
...
@@ -125,4 +124,8 @@ describe NoteObserver do
...
@@ -125,4 +124,8 @@ describe NoteObserver do
subject
.
send
(
:team_without_note_author
,
note
).
should
==
team_without_author
subject
.
send
(
:team_without_note_author
,
note
).
should
==
team_without_author
end
end
end
end
def
notify
Notify
end
end
end
spec/observers/user_observer_spec.rb
View file @
9773ccc4
...
@@ -10,24 +10,14 @@ describe UserObserver do
...
@@ -10,24 +10,14 @@ describe UserObserver do
end
end
context
'when a new user is created'
do
context
'when a new user is created'
do
let
(
:user
)
{
double
(
:user
,
id:
42
,
password:
'P@ssword!'
,
name:
'John'
,
email:
'u@mail.local'
,
username:
'root'
,
create_namespace:
true
)
}
let
(
:notification
)
{
double
:notification
}
it
'sends an email'
do
it
'sends an email'
do
notification
.
should_receive
(
:deliver
)
Notify
.
should_receive
(
:new_user_email
)
Notify
.
should_receive
(
:new_user_email
).
with
(
user
.
id
,
user
.
password
).
and_return
(
notification
)
create
(
:user
)
subject
.
after_create
(
user
)
end
end
it
'trigger logger'
do
it
'trigger logger'
do
Gitlab
::
AppLogger
.
should_receive
(
:info
)
Gitlab
::
AppLogger
.
should_receive
(
:info
)
subject
.
after_create
(
user
)
create
(
:
user
)
end
end
end
end
end
end
spec/requests/admin/admin_users_spec.rb
View file @
9773ccc4
...
@@ -41,7 +41,7 @@ describe "Admin::Users" do
...
@@ -41,7 +41,7 @@ describe "Admin::Users" do
end
end
it
"should call send mail"
do
it
"should call send mail"
do
Notify
.
should_receive
(
:new_user_email
)
.
and_return
(
stub
(
deliver:
true
))
Notify
.
should_receive
(
:new_user_email
)
User
.
observers
.
enable
:user_observer
do
User
.
observers
.
enable
:user_observer
do
click_button
"Save"
click_button
"Save"
...
@@ -50,9 +50,7 @@ describe "Admin::Users" do
...
@@ -50,9 +50,7 @@ describe "Admin::Users" do
it
"should send valid email to user with email & password"
do
it
"should send valid email to user with email & password"
do
User
.
observers
.
enable
:user_observer
do
User
.
observers
.
enable
:user_observer
do
with_resque
do
click_button
"Save"
click_button
"Save"
end
user
=
User
.
last
user
=
User
.
last
email
=
ActionMailer
::
Base
.
deliveries
.
last
email
=
ActionMailer
::
Base
.
deliveries
.
last
email
.
subject
.
should
have_content
(
"Account was created"
)
email
.
subject
.
should
have_content
(
"Account was created"
)
...
...
spec/spec_helper.rb
View file @
9773ccc4
require
'simplecov'
unless
ENV
[
'CI'
]
require
'simplecov'
unless
ENV
[
'CI'
]
# This file is copied to spec/ when you run 'rails generate rspec:install'
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV
[
"RAILS_ENV"
]
||=
'test'
ENV
[
"RAILS_ENV"
]
||=
'test'
require
File
.
expand_path
(
"../../config/environment"
,
__FILE__
)
require
File
.
expand_path
(
"../../config/environment"
,
__FILE__
)
...
@@ -8,6 +9,7 @@ require 'capybara/rails'
...
@@ -8,6 +9,7 @@ require 'capybara/rails'
require
'capybara/rspec'
require
'capybara/rspec'
require
'webmock/rspec'
require
'webmock/rspec'
require
'email_spec'
require
'email_spec'
require
'sidekiq/testing/inline'
# Requires supporting ruby files with custom matchers and macros, etc,
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
# in spec/support/ and its subdirectories.
...
...
spec/workers/post_receive_spec.rb
View file @
9773ccc4
...
@@ -4,7 +4,7 @@ describe PostReceive do
...
@@ -4,7 +4,7 @@ describe PostReceive do
context
"as a resque worker"
do
context
"as a resque worker"
do
it
"reponds to #perform"
do
it
"reponds to #perform"
do
PostReceive
.
should
respond_to
(
:perform
)
PostReceive
.
new
.
should
respond_to
(
:perform
)
end
end
end
end
...
@@ -15,7 +15,7 @@ describe PostReceive do
...
@@ -15,7 +15,7 @@ describe PostReceive do
it
"fetches the correct project"
do
it
"fetches the correct project"
do
Project
.
should_receive
(
:find_with_namespace
).
with
(
project
.
path_with_namespace
).
and_return
(
project
)
Project
.
should_receive
(
:find_with_namespace
).
with
(
project
.
path_with_namespace
).
and_return
(
project
)
PostReceive
.
perform
(
pwd
(
project
),
'sha-old'
,
'sha-new'
,
'refs/heads/master'
,
key_id
)
PostReceive
.
new
.
perform
(
pwd
(
project
),
'sha-old'
,
'sha-new'
,
'refs/heads/master'
,
key_id
)
end
end
it
"does not run if the author is not in the project"
do
it
"does not run if the author is not in the project"
do
...
@@ -24,7 +24,7 @@ describe PostReceive do
...
@@ -24,7 +24,7 @@ describe PostReceive do
project
.
should_not_receive
(
:observe_push
)
project
.
should_not_receive
(
:observe_push
)
project
.
should_not_receive
(
:execute_hooks
)
project
.
should_not_receive
(
:execute_hooks
)
PostReceive
.
perform
(
pwd
(
project
),
'sha-old'
,
'sha-new'
,
'refs/heads/master'
,
key_id
).
should
be_false
PostReceive
.
new
.
perform
(
pwd
(
project
),
'sha-old'
,
'sha-new'
,
'refs/heads/master'
,
key_id
).
should
be_false
end
end
it
"asks the project to trigger all hooks"
do
it
"asks the project to trigger all hooks"
do
...
@@ -34,7 +34,7 @@ describe PostReceive do
...
@@ -34,7 +34,7 @@ describe PostReceive do
project
.
should_receive
(
:update_merge_requests
)
project
.
should_receive
(
:update_merge_requests
)
project
.
should_receive
(
:observe_push
)
project
.
should_receive
(
:observe_push
)
PostReceive
.
perform
(
pwd
(
project
),
'sha-old'
,
'sha-new'
,
'refs/heads/master'
,
key_id
)
PostReceive
.
new
.
perform
(
pwd
(
project
),
'sha-old'
,
'sha-new'
,
'refs/heads/master'
,
key_id
)
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