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
Tatuya Kamada
gitlab-ce
Commits
15a05be7
Commit
15a05be7
authored
Jun 22, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Style/Blocks cop violations
parent
88328392
Changes
34
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
197 additions
and
213 deletions
+197
-213
spec/controllers/branches_controller_spec.rb
spec/controllers/branches_controller_spec.rb
+2
-2
spec/controllers/import/bitbucket_controller_spec.rb
spec/controllers/import/bitbucket_controller_spec.rb
+8
-15
spec/controllers/import/github_controller_spec.rb
spec/controllers/import/github_controller_spec.rb
+8
-8
spec/controllers/import/gitlab_controller_spec.rb
spec/controllers/import/gitlab_controller_spec.rb
+5
-9
spec/features/issues_spec.rb
spec/features/issues_spec.rb
+1
-3
spec/helpers/tree_helper_spec.rb
spec/helpers/tree_helper_spec.rb
+3
-4
spec/lib/disable_email_interceptor_spec.rb
spec/lib/disable_email_interceptor_spec.rb
+1
-3
spec/lib/file_size_validator_spec.rb
spec/lib/file_size_validator_spec.rb
+7
-2
spec/lib/gitlab/backend/grack_auth_spec.rb
spec/lib/gitlab/backend/grack_auth_spec.rb
+5
-5
spec/lib/gitlab/bitbucket_import/project_creator_spec.rb
spec/lib/gitlab/bitbucket_import/project_creator_spec.rb
+11
-9
spec/lib/gitlab/github_import/project_creator_spec.rb
spec/lib/gitlab/github_import/project_creator_spec.rb
+12
-10
spec/lib/gitlab/gitlab_import/project_creator_spec.rb
spec/lib/gitlab/gitlab_import/project_creator_spec.rb
+12
-10
spec/lib/gitlab/google_code_import/importer_spec.rb
spec/lib/gitlab/google_code_import/importer_spec.rb
+7
-8
spec/lib/gitlab/google_code_import/project_creator_spec.rb
spec/lib/gitlab/google_code_import/project_creator_spec.rb
+6
-6
spec/lib/gitlab/o_auth/auth_hash_spec.rb
spec/lib/gitlab/o_auth/auth_hash_spec.rb
+9
-9
spec/lib/gitlab/satellite/action_spec.rb
spec/lib/gitlab/satellite/action_spec.rb
+2
-2
spec/lib/gitlab/satellite/merge_action_spec.rb
spec/lib/gitlab/satellite/merge_action_spec.rb
+12
-12
spec/mailers/notify_spec.rb
spec/mailers/notify_spec.rb
+1
-3
spec/models/deploy_keys_project_spec.rb
spec/models/deploy_keys_project_spec.rb
+1
-3
spec/models/hooks/service_hook_spec.rb
spec/models/hooks/service_hook_spec.rb
+1
-3
spec/models/hooks/web_hook_spec.rb
spec/models/hooks/web_hook_spec.rb
+1
-3
spec/models/project_services/slack_service/issue_message_spec.rb
...dels/project_services/slack_service/issue_message_spec.rb
+2
-2
spec/models/project_services/slack_service/merge_message_spec.rb
...dels/project_services/slack_service/merge_message_spec.rb
+2
-2
spec/models/project_services/slack_service/push_message_spec.rb
...odels/project_services/slack_service/push_message_spec.rb
+10
-10
spec/models/service_spec.rb
spec/models/service_spec.rb
+10
-3
spec/requests/api/files_spec.rb
spec/requests/api/files_spec.rb
+6
-6
spec/requests/api/fork_spec.rb
spec/requests/api/fork_spec.rb
+8
-9
spec/requests/api/group_members_spec.rb
spec/requests/api/group_members_spec.rb
+8
-10
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+3
-2
spec/requests/api/project_hooks_spec.rb
spec/requests/api/project_hooks_spec.rb
+5
-6
spec/requests/api/project_members_spec.rb
spec/requests/api/project_members_spec.rb
+12
-14
spec/services/archive_repository_service_spec.rb
spec/services/archive_repository_service_spec.rb
+1
-3
spec/services/git_push_service_spec.rb
spec/services/git_push_service_spec.rb
+6
-6
spec/services/issues/bulk_update_service_spec.rb
spec/services/issues/bulk_update_service_spec.rb
+9
-11
No files found.
spec/controllers/branches_controller_spec.rb
View file @
15a05be7
...
@@ -17,13 +17,13 @@ describe Projects::BranchesController do
...
@@ -17,13 +17,13 @@ describe Projects::BranchesController do
describe
"POST create"
do
describe
"POST create"
do
render_views
render_views
before
{
before
do
post
:create
,
post
:create
,
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
project_id:
project
.
to_param
,
branch_name:
branch
,
branch_name:
branch
,
ref:
ref
ref:
ref
}
end
context
"valid branch name, valid source"
do
context
"valid branch name, valid source"
do
let
(
:branch
)
{
"merge_branch"
}
let
(
:branch
)
{
"merge_branch"
}
...
...
spec/controllers/import/bitbucket_controller_spec.rb
View file @
15a05be7
...
@@ -12,7 +12,7 @@ describe Import::BitbucketController do
...
@@ -12,7 +12,7 @@ describe Import::BitbucketController do
before
do
before
do
session
[
:oauth_request_token
]
=
{}
session
[
:oauth_request_token
]
=
{}
end
end
it
"updates access token"
do
it
"updates access token"
do
token
=
"asdasd12345"
token
=
"asdasd12345"
secret
=
"sekrettt"
secret
=
"sekrettt"
...
@@ -57,20 +57,13 @@ describe Import::BitbucketController do
...
@@ -57,20 +57,13 @@ describe Import::BitbucketController do
describe
"POST create"
do
describe
"POST create"
do
let
(
:bitbucket_username
)
{
user
.
username
}
let
(
:bitbucket_username
)
{
user
.
username
}
let
(
:bitbucket_user
)
{
let
(
:bitbucket_user
)
do
{
{
user:
{
username:
bitbucket_username
}
}.
with_indifferent_access
user:
{
end
username:
bitbucket_username
}
let
(
:bitbucket_repo
)
do
}.
with_indifferent_access
{
slug:
"vim"
,
owner:
bitbucket_username
}.
with_indifferent_access
}
end
let
(
:bitbucket_repo
)
{
{
slug:
"vim"
,
owner:
bitbucket_username
}.
with_indifferent_access
}
before
do
before
do
allow
(
Gitlab
::
BitbucketImport
::
KeyAdder
).
allow
(
Gitlab
::
BitbucketImport
::
KeyAdder
).
...
...
spec/controllers/import/github_controller_spec.rb
View file @
15a05be7
...
@@ -57,14 +57,14 @@ describe Import::GithubController do
...
@@ -57,14 +57,14 @@ describe Import::GithubController do
describe
"POST create"
do
describe
"POST create"
do
let
(
:github_username
)
{
user
.
username
}
let
(
:github_username
)
{
user
.
username
}
let
(
:github_user
)
{
OpenStruct
.
new
(
login:
github_username
)
}
let
(
:github_
user
)
{
let
(
:github_
repo
)
do
OpenStruct
.
new
(
login:
github_username
)
OpenStruct
.
new
(
}
name:
'vim'
,
full_name:
"
#{
github_username
}
/vim"
,
let
(
:github_repo
)
{
owner:
OpenStruct
.
new
(
login:
github_username
)
OpenStruct
.
new
(
name:
'vim'
,
full_name:
"
#{
github_username
}
/vim"
,
owner:
OpenStruct
.
new
(
login:
github_username
)
)
)
}
end
before
do
before
do
controller
.
stub_chain
(
:client
,
:user
).
and_return
(
github_user
)
controller
.
stub_chain
(
:client
,
:user
).
and_return
(
github_user
)
...
...
spec/controllers/import/gitlab_controller_spec.rb
View file @
15a05be7
...
@@ -49,21 +49,17 @@ describe Import::GitlabController do
...
@@ -49,21 +49,17 @@ describe Import::GitlabController do
describe
"POST create"
do
describe
"POST create"
do
let
(
:gitlab_username
)
{
user
.
username
}
let
(
:gitlab_username
)
{
user
.
username
}
let
(
:gitlab_user
)
do
let
(
:gitlab_user
)
{
{
username:
gitlab_username
}.
with_indifferent_access
{
end
username:
gitlab_username
let
(
:gitlab_repo
)
do
}.
with_indifferent_access
}
let
(
:gitlab_repo
)
{
{
{
path:
'vim'
,
path:
'vim'
,
path_with_namespace:
"
#{
gitlab_username
}
/vim"
,
path_with_namespace:
"
#{
gitlab_username
}
/vim"
,
owner:
{
name:
gitlab_username
},
owner:
{
name:
gitlab_username
},
namespace:
{
path:
gitlab_username
}
namespace:
{
path:
gitlab_username
}
}.
with_indifferent_access
}.
with_indifferent_access
}
end
before
do
before
do
controller
.
stub_chain
(
:client
,
:user
).
and_return
(
gitlab_user
)
controller
.
stub_chain
(
:client
,
:user
).
and_return
(
gitlab_user
)
...
...
spec/features/issues_spec.rb
View file @
15a05be7
...
@@ -36,9 +36,7 @@ describe 'Issues', feature: true do
...
@@ -36,9 +36,7 @@ describe 'Issues', feature: true do
end
end
it
'does not change issue count'
do
it
'does not change issue count'
do
expect
{
expect
{
click_button
'Save changes'
}.
to_not
change
{
Issue
.
count
}
click_button
'Save changes'
}.
to_not
change
{
Issue
.
count
}
end
end
it
'should update issue fields'
do
it
'should update issue fields'
do
...
...
spec/helpers/tree_helper_spec.rb
View file @
15a05be7
...
@@ -4,10 +4,9 @@ describe TreeHelper do
...
@@ -4,10 +4,9 @@ describe TreeHelper do
describe
'flatten_tree'
do
describe
'flatten_tree'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
before
{
before
do
@repository
=
project
.
repository
@repository
=
project
.
repository
@commit
=
project
.
commit
(
"e56497bb"
)
@commit
=
project
.
commit
(
"e56497bb"
)
end
}
context
"on a directory containing more than one file/directory"
do
context
"on a directory containing more than one file/directory"
do
let
(
:tree_item
)
{
double
(
name:
"files"
,
path:
"files"
)
}
let
(
:tree_item
)
{
double
(
name:
"files"
,
path:
"files"
)
}
...
...
spec/lib/disable_email_interceptor_spec.rb
View file @
15a05be7
...
@@ -7,9 +7,7 @@ describe DisableEmailInterceptor do
...
@@ -7,9 +7,7 @@ describe DisableEmailInterceptor do
it
'should not send emails'
do
it
'should not send emails'
do
allow
(
Gitlab
.
config
.
gitlab
).
to
receive
(
:email_enabled
).
and_return
(
false
)
allow
(
Gitlab
.
config
.
gitlab
).
to
receive
(
:email_enabled
).
and_return
(
false
)
expect
{
expect
{
deliver_mail
}.
not_to
change
(
ActionMailer
::
Base
.
deliveries
,
:count
)
deliver_mail
}.
not_to
change
(
ActionMailer
::
Base
.
deliveries
,
:count
)
end
end
after
do
after
do
...
...
spec/lib/file_size_validator_spec.rb
View file @
15a05be7
...
@@ -22,8 +22,13 @@ describe 'Gitlab::FileSizeValidatorSpec' do
...
@@ -22,8 +22,13 @@ describe 'Gitlab::FileSizeValidatorSpec' do
end
end
describe
'options uses a symbol'
do
describe
'options uses a symbol'
do
let
(
:options
)
{
{
maximum: :test
,
let
(
:options
)
do
attributes:
{
attachment:
attachment
}
}
}
{
maximum: :test
,
attributes:
{
attachment:
attachment
}
}
end
before
do
before
do
allow
(
note
).
to
receive
(
:test
)
{
10
}
allow
(
note
).
to
receive
(
:test
)
{
10
}
end
end
...
...
spec/lib/gitlab/backend/grack_auth_spec.rb
View file @
15a05be7
...
@@ -6,13 +6,13 @@ describe Grack::Auth do
...
@@ -6,13 +6,13 @@ describe Grack::Auth do
let
(
:app
)
{
lambda
{
|
env
|
[
200
,
{},
"Success!"
]
}
}
let
(
:app
)
{
lambda
{
|
env
|
[
200
,
{},
"Success!"
]
}
}
let!
(
:auth
)
{
Grack
::
Auth
.
new
(
app
)
}
let!
(
:auth
)
{
Grack
::
Auth
.
new
(
app
)
}
let
(
:env
)
{
let
(
:env
)
do
{
{
"rack.input"
=>
""
,
'rack.input'
=>
''
,
"REQUEST_METHOD"
=>
"GET"
,
'REQUEST_METHOD'
=>
'GET'
,
"QUERY_STRING"
=>
"service=git-upload-pack"
'QUERY_STRING'
=>
'service=git-upload-pack'
}
}
}
end
let
(
:status
)
{
auth
.
call
(
env
).
first
}
let
(
:status
)
{
auth
.
call
(
env
).
first
}
describe
"#call"
do
describe
"#call"
do
...
...
spec/lib/gitlab/bitbucket_import/project_creator_spec.rb
View file @
15a05be7
...
@@ -2,24 +2,26 @@ require 'spec_helper'
...
@@ -2,24 +2,26 @@ require 'spec_helper'
describe
Gitlab
::
BitbucketImport
::
ProjectCreator
do
describe
Gitlab
::
BitbucketImport
::
ProjectCreator
do
let
(
:user
)
{
create
(
:user
,
bitbucket_access_token:
"asdffg"
,
bitbucket_access_token_secret:
"sekret"
)
}
let
(
:user
)
{
create
(
:user
,
bitbucket_access_token:
"asdffg"
,
bitbucket_access_token_secret:
"sekret"
)
}
let
(
:repo
)
{
{
let
(
:repo
)
do
name:
'Vim'
,
{
slug:
'vim'
,
name:
'Vim'
,
is_private:
true
,
slug:
'vim'
,
owner:
"asd"
}.
with_indifferent_access
is_private:
true
,
}
owner:
"asd"
}.
with_indifferent_access
end
let
(
:namespace
){
create
(
:group
,
owner:
user
)
}
let
(
:namespace
){
create
(
:group
,
owner:
user
)
}
before
do
before
do
namespace
.
add_owner
(
user
)
namespace
.
add_owner
(
user
)
end
end
it
'creates project'
do
it
'creates project'
do
allow_any_instance_of
(
Project
).
to
receive
(
:add_import_job
)
allow_any_instance_of
(
Project
).
to
receive
(
:add_import_job
)
project_creator
=
Gitlab
::
BitbucketImport
::
ProjectCreator
.
new
(
repo
,
namespace
,
user
)
project_creator
=
Gitlab
::
BitbucketImport
::
ProjectCreator
.
new
(
repo
,
namespace
,
user
)
project
=
project_creator
.
execute
project
=
project_creator
.
execute
expect
(
project
.
import_url
).
to
eq
(
"ssh://git@bitbucket.org/asd/vim.git"
)
expect
(
project
.
import_url
).
to
eq
(
"ssh://git@bitbucket.org/asd/vim.git"
)
expect
(
project
.
visibility_level
).
to
eq
(
Gitlab
::
VisibilityLevel
::
PRIVATE
)
expect
(
project
.
visibility_level
).
to
eq
(
Gitlab
::
VisibilityLevel
::
PRIVATE
)
end
end
...
...
spec/lib/gitlab/github_import/project_creator_spec.rb
View file @
15a05be7
...
@@ -2,14 +2,16 @@ require 'spec_helper'
...
@@ -2,14 +2,16 @@ require 'spec_helper'
describe
Gitlab
::
GithubImport
::
ProjectCreator
do
describe
Gitlab
::
GithubImport
::
ProjectCreator
do
let
(
:user
)
{
create
(
:user
,
github_access_token:
"asdffg"
)
}
let
(
:user
)
{
create
(
:user
,
github_access_token:
"asdffg"
)
}
let
(
:repo
)
{
OpenStruct
.
new
(
let
(
:repo
)
do
login:
'vim'
,
OpenStruct
.
new
(
name:
'vim'
,
login:
'vim'
,
private:
true
,
name:
'vim'
,
full_name:
'asd/vim'
,
private:
true
,
clone_url:
"https://gitlab.com/asd/vim.git"
,
full_name:
'asd/vim'
,
owner:
OpenStruct
.
new
(
login:
"john"
))
clone_url:
"https://gitlab.com/asd/vim.git"
,
}
owner:
OpenStruct
.
new
(
login:
"john"
)
)
end
let
(
:namespace
){
create
(
:group
,
owner:
user
)
}
let
(
:namespace
){
create
(
:group
,
owner:
user
)
}
before
do
before
do
...
@@ -18,10 +20,10 @@ describe Gitlab::GithubImport::ProjectCreator do
...
@@ -18,10 +20,10 @@ describe Gitlab::GithubImport::ProjectCreator do
it
'creates project'
do
it
'creates project'
do
allow_any_instance_of
(
Project
).
to
receive
(
:add_import_job
)
allow_any_instance_of
(
Project
).
to
receive
(
:add_import_job
)
project_creator
=
Gitlab
::
GithubImport
::
ProjectCreator
.
new
(
repo
,
namespace
,
user
)
project_creator
=
Gitlab
::
GithubImport
::
ProjectCreator
.
new
(
repo
,
namespace
,
user
)
project
=
project_creator
.
execute
project
=
project_creator
.
execute
expect
(
project
.
import_url
).
to
eq
(
"https://asdffg@gitlab.com/asd/vim.git"
)
expect
(
project
.
import_url
).
to
eq
(
"https://asdffg@gitlab.com/asd/vim.git"
)
expect
(
project
.
visibility_level
).
to
eq
(
Gitlab
::
VisibilityLevel
::
PRIVATE
)
expect
(
project
.
visibility_level
).
to
eq
(
Gitlab
::
VisibilityLevel
::
PRIVATE
)
end
end
...
...
spec/lib/gitlab/gitlab_import/project_creator_spec.rb
View file @
15a05be7
...
@@ -2,14 +2,16 @@ require 'spec_helper'
...
@@ -2,14 +2,16 @@ require 'spec_helper'
describe
Gitlab
::
GitlabImport
::
ProjectCreator
do
describe
Gitlab
::
GitlabImport
::
ProjectCreator
do
let
(
:user
)
{
create
(
:user
,
gitlab_access_token:
"asdffg"
)
}
let
(
:user
)
{
create
(
:user
,
gitlab_access_token:
"asdffg"
)
}
let
(
:repo
)
{
{
let
(
:repo
)
do
name:
'vim'
,
{
path:
'vim'
,
name:
'vim'
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PRIVATE
,
path:
'vim'
,
path_with_namespace:
'asd/vim'
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PRIVATE
,
http_url_to_repo:
"https://gitlab.com/asd/vim.git"
,
path_with_namespace:
'asd/vim'
,
owner:
{
name:
"john"
}
}.
with_indifferent_access
http_url_to_repo:
"https://gitlab.com/asd/vim.git"
,
}
owner:
{
name:
"john"
}
}.
with_indifferent_access
end
let
(
:namespace
){
create
(
:group
,
owner:
user
)
}
let
(
:namespace
){
create
(
:group
,
owner:
user
)
}
before
do
before
do
...
@@ -18,10 +20,10 @@ describe Gitlab::GitlabImport::ProjectCreator do
...
@@ -18,10 +20,10 @@ describe Gitlab::GitlabImport::ProjectCreator do
it
'creates project'
do
it
'creates project'
do
allow_any_instance_of
(
Project
).
to
receive
(
:add_import_job
)
allow_any_instance_of
(
Project
).
to
receive
(
:add_import_job
)
project_creator
=
Gitlab
::
GitlabImport
::
ProjectCreator
.
new
(
repo
,
namespace
,
user
)
project_creator
=
Gitlab
::
GitlabImport
::
ProjectCreator
.
new
(
repo
,
namespace
,
user
)
project
=
project_creator
.
execute
project
=
project_creator
.
execute
expect
(
project
.
import_url
).
to
eq
(
"https://oauth2:asdffg@gitlab.com/asd/vim.git"
)
expect
(
project
.
import_url
).
to
eq
(
"https://oauth2:asdffg@gitlab.com/asd/vim.git"
)
expect
(
project
.
visibility_level
).
to
eq
(
Gitlab
::
VisibilityLevel
::
PRIVATE
)
expect
(
project
.
visibility_level
).
to
eq
(
Gitlab
::
VisibilityLevel
::
PRIVATE
)
end
end
...
...
spec/lib/gitlab/google_code_import/importer_spec.rb
View file @
15a05be7
...
@@ -4,16 +4,15 @@ describe Gitlab::GoogleCodeImport::Importer do
...
@@ -4,16 +4,15 @@ describe Gitlab::GoogleCodeImport::Importer do
let
(
:mapped_user
)
{
create
(
:user
,
username:
"thilo123"
)
}
let
(
:mapped_user
)
{
create
(
:user
,
username:
"thilo123"
)
}
let
(
:raw_data
)
{
JSON
.
parse
(
File
.
read
(
Rails
.
root
.
join
(
"spec/fixtures/GoogleCodeProjectHosting.json"
)))
}
let
(
:raw_data
)
{
JSON
.
parse
(
File
.
read
(
Rails
.
root
.
join
(
"spec/fixtures/GoogleCodeProjectHosting.json"
)))
}
let
(
:client
)
{
Gitlab
::
GoogleCodeImport
::
Client
.
new
(
raw_data
)
}
let
(
:client
)
{
Gitlab
::
GoogleCodeImport
::
Client
.
new
(
raw_data
)
}
let
(
:import_data
)
{
let
(
:import_data
)
do
{
{
"repo"
=>
client
.
repo
(
"tint2"
).
raw_data
,
'repo'
=>
client
.
repo
(
'tint2'
).
raw_data
,
"user_map"
=>
{
'user_map'
=>
{
'thilo...'
=>
"@
#{
mapped_user
.
username
}
"
}
"thilo..."
=>
"@
#{
mapped_user
.
username
}
"
}
}
end
}
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
subject
{
described_class
.
new
(
project
)
}
subject
{
described_class
.
new
(
project
)
}
before
do
before
do
project
.
create_import_data
(
data:
import_data
)
project
.
create_import_data
(
data:
import_data
)
...
...
spec/lib/gitlab/google_code_import/project_creator_spec.rb
View file @
15a05be7
...
@@ -2,13 +2,13 @@ require 'spec_helper'
...
@@ -2,13 +2,13 @@ require 'spec_helper'
describe
Gitlab
::
GoogleCodeImport
::
ProjectCreator
do
describe
Gitlab
::
GoogleCodeImport
::
ProjectCreator
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:repo
)
{
let
(
:repo
)
do
Gitlab
::
GoogleCodeImport
::
Repository
.
new
(
Gitlab
::
GoogleCodeImport
::
Repository
.
new
(
"name"
=>
'vim'
,
"name"
=>
'vim'
,
"summary"
=>
'VI Improved'
,
"summary"
=>
'VI Improved'
,
"repositoryUrls"
=>
[
"https://vim.googlecode.com/git/"
]
"repositoryUrls"
=>
[
"https://vim.googlecode.com/git/"
]
)
)
}
end
let
(
:namespace
){
create
(
:group
,
owner:
user
)
}
let
(
:namespace
){
create
(
:group
,
owner:
user
)
}
before
do
before
do
...
@@ -20,7 +20,7 @@ describe Gitlab::GoogleCodeImport::ProjectCreator do
...
@@ -20,7 +20,7 @@ describe Gitlab::GoogleCodeImport::ProjectCreator do
project_creator
=
Gitlab
::
GoogleCodeImport
::
ProjectCreator
.
new
(
repo
,
namespace
,
user
)
project_creator
=
Gitlab
::
GoogleCodeImport
::
ProjectCreator
.
new
(
repo
,
namespace
,
user
)
project
=
project_creator
.
execute
project
=
project_creator
.
execute
expect
(
project
.
import_url
).
to
eq
(
"https://vim.googlecode.com/git/"
)
expect
(
project
.
import_url
).
to
eq
(
"https://vim.googlecode.com/git/"
)
expect
(
project
.
visibility_level
).
to
eq
(
Gitlab
::
VisibilityLevel
::
PUBLIC
)
expect
(
project
.
visibility_level
).
to
eq
(
Gitlab
::
VisibilityLevel
::
PUBLIC
)
end
end
...
...
spec/lib/gitlab/o_auth/auth_hash_spec.rb
View file @
15a05be7
...
@@ -11,9 +11,9 @@ describe Gitlab::OAuth::AuthHash do
...
@@ -11,9 +11,9 @@ describe Gitlab::OAuth::AuthHash do
)
)
end
end
let
(
:uid_raw
)
{
let
(
:uid_raw
)
do
"CN=Onur K
\xC3\xBC\xC3\xA7\xC3\xBC
k,OU=Test,DC=example,DC=net"
"CN=Onur K
\xC3\xBC\xC3\xA7\xC3\xBC
k,OU=Test,DC=example,DC=net"
}
end
let
(
:email_raw
)
{
"onur.k
\xC3\xBC\xC3\xA7\xC3\xBC
k@example.net"
}
let
(
:email_raw
)
{
"onur.k
\xC3\xBC\xC3\xA7\xC3\xBC
k@example.net"
}
let
(
:nickname_raw
)
{
"ok
\xC3\xBC\xC3\xA7\xC3\xBC
k"
}
let
(
:nickname_raw
)
{
"ok
\xC3\xBC\xC3\xA7\xC3\xBC
k"
}
let
(
:first_name_raw
)
{
'Onur'
}
let
(
:first_name_raw
)
{
'Onur'
}
...
@@ -34,16 +34,16 @@ describe Gitlab::OAuth::AuthHash do
...
@@ -34,16 +34,16 @@ describe Gitlab::OAuth::AuthHash do
let
(
:nickname_utf8
)
{
nickname_ascii
.
force_encoding
(
Encoding
::
UTF_8
)
}
let
(
:nickname_utf8
)
{
nickname_ascii
.
force_encoding
(
Encoding
::
UTF_8
)
}
let
(
:name_utf8
)
{
name_ascii
.
force_encoding
(
Encoding
::
UTF_8
)
}
let
(
:name_utf8
)
{
name_ascii
.
force_encoding
(
Encoding
::
UTF_8
)
}
let
(
:info_hash
)
{
let
(
:info_hash
)
do
{
{
email:
email_ascii
,
email:
email_ascii
,
first_name:
first_name_ascii
,
first_name:
first_name_ascii
,
last_name:
last_name_ascii
,
last_name:
last_name_ascii
,
name:
name_ascii
,
name:
name_ascii
,
nickname:
nickname_ascii
,
nickname:
nickname_ascii
,
uid:
uid_ascii
uid:
uid_ascii
}
}
}
end
context
'defaults'
do
context
'defaults'
do
it
{
expect
(
auth_hash
.
provider
).
to
eql
provider_utf8
}
it
{
expect
(
auth_hash
.
provider
).
to
eql
provider_utf8
}
...
...
spec/lib/gitlab/satellite/action_spec.rb
View file @
15a05be7
...
@@ -33,10 +33,10 @@ describe 'Gitlab::Satellite::Action' do
...
@@ -33,10 +33,10 @@ describe 'Gitlab::Satellite::Action' do
#These must happen in the context of the satellite directory...
#These must happen in the context of the satellite directory...
satellite_action
=
Gitlab
::
Satellite
::
Action
.
new
(
user
,
project
)
satellite_action
=
Gitlab
::
Satellite
::
Action
.
new
(
user
,
project
)
project
.
satellite
.
lock
{
project
.
satellite
.
lock
do
#Now clean it up, use send to get around prepare_satellite! being protected
#Now clean it up, use send to get around prepare_satellite! being protected
satellite_action
.
send
(
:prepare_satellite!
,
repo
)
satellite_action
.
send
(
:prepare_satellite!
,
repo
)
}
end
#verify it's clean
#verify it's clean
heads
=
repo
.
heads
.
map
(
&
:name
)
heads
=
repo
.
heads
.
map
(
&
:name
)
...
...
spec/lib/gitlab/satellite/merge_action_spec.rb
View file @
15a05be7
...
@@ -82,23 +82,23 @@ describe 'Gitlab::Satellite::MergeAction' do
...
@@ -82,23 +82,23 @@ describe 'Gitlab::Satellite::MergeAction' do
describe
'#can_be_merged?'
do
describe
'#can_be_merged?'
do
context
'on fork'
do
context
'on fork'
do
it
{
expect
(
Gitlab
::
Satellite
::
MergeAction
.
new
(
it
do
merge_request_fork
.
author
,
expect
(
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request_fork
.
author
,
merge_request_fork
).
can_be_merged?
).
to
be_truthy
merge_request_fork
).
can_be_merged?
).
to
be_truthy
}
end
it
{
expect
(
Gitlab
::
Satellite
::
MergeAction
.
new
(
it
do
merge_request_fork_with_conflict
.
author
,
expect
(
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request_fork_with_conflict
.
author
,
merge_request_fork_with_conflict
).
can_be_merged?
).
to
be_falsey
merge_request_fork_with_conflict
).
can_be_merged?
).
to
be_falsey
}
end
end
end
context
'between branches'
do
context
'between branches'
do
it
{
expect
(
Gitlab
::
Satellite
::
MergeAction
.
new
(
it
do
merge_request
.
author
,
expect
(
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request
.
author
,
merge_request
).
can_be_merged?
).
to
be_truthy
merge_request
).
can_be_merged?
).
to
be_truthy
}
end
it
{
expect
(
Gitlab
::
Satellite
::
MergeAction
.
new
(
it
do
merge_request_with_conflict
.
author
,
expect
(
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request_with_conflict
.
author
,
merge_request_with_conflict
).
can_be_merged?
).
to
be_falsey
merge_request_with_conflict
).
can_be_merged?
).
to
be_falsey
}
end
end
end
end
end
end
end
spec/mailers/notify_spec.rb
View file @
15a05be7
...
@@ -418,9 +418,7 @@ describe Notify do
...
@@ -418,9 +418,7 @@ describe Notify do
describe
'project access changed'
do
describe
'project access changed'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project_member
)
{
create
(
:project_member
,
let
(
:project_member
)
{
create
(
:project_member
,
project:
project
,
user:
user
)
}
project:
project
,
user:
user
)
}
subject
{
Notify
.
project_access_granted_email
(
project_member
.
id
)
}
subject
{
Notify
.
project_access_granted_email
(
project_member
.
id
)
}
it_behaves_like
'an email sent from GitLab'
it_behaves_like
'an email sent from GitLab'
...
...
spec/models/deploy_keys_project_spec.rb
View file @
15a05be7
...
@@ -44,9 +44,7 @@ describe DeployKeysProject do
...
@@ -44,9 +44,7 @@ describe DeployKeysProject do
it
"destroys the deploy key"
do
it
"destroys the deploy key"
do
subject
.
destroy
subject
.
destroy
expect
{
expect
{
deploy_key
.
reload
}.
to
raise_error
(
ActiveRecord
::
RecordNotFound
)
deploy_key
.
reload
}.
to
raise_error
(
ActiveRecord
::
RecordNotFound
)
end
end
end
end
end
end
...
...
spec/models/hooks/service_hook_spec.rb
View file @
15a05be7
...
@@ -50,9 +50,7 @@ describe ServiceHook do
...
@@ -50,9 +50,7 @@ describe ServiceHook do
it
"catches exceptions"
do
it
"catches exceptions"
do
expect
(
WebHook
).
to
receive
(
:post
).
and_raise
(
"Some HTTP Post error"
)
expect
(
WebHook
).
to
receive
(
:post
).
and_raise
(
"Some HTTP Post error"
)
expect
{
expect
{
@service_hook
.
execute
(
@data
)
}.
to
raise_error
@service_hook
.
execute
(
@data
)
}.
to
raise_error
end
end
end
end
end
end
spec/models/hooks/web_hook_spec.rb
View file @
15a05be7
...
@@ -71,9 +71,7 @@ describe ProjectHook do
...
@@ -71,9 +71,7 @@ describe ProjectHook do
it
"catches exceptions"
do
it
"catches exceptions"
do
expect
(
WebHook
).
to
receive
(
:post
).
and_raise
(
"Some HTTP Post error"
)
expect
(
WebHook
).
to
receive
(
:post
).
and_raise
(
"Some HTTP Post error"
)
expect
{
expect
{
@project_hook
.
execute
(
@data
,
'push_hooks'
)
}.
to
raise_error
@project_hook
.
execute
(
@data
,
'push_hooks'
)
}.
to
raise_error
end
end
end
end
end
end
spec/models/project_services/slack_service/issue_message_spec.rb
View file @
15a05be7
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
SlackService
::
IssueMessage
do
describe
SlackService
::
IssueMessage
do
subject
{
SlackService
::
IssueMessage
.
new
(
args
)
}
subject
{
SlackService
::
IssueMessage
.
new
(
args
)
}
let
(
:args
)
{
let
(
:args
)
do
{
{
user:
{
user:
{
name:
'Test User'
,
name:
'Test User'
,
...
@@ -23,7 +23,7 @@ describe SlackService::IssueMessage do
...
@@ -23,7 +23,7 @@ describe SlackService::IssueMessage do
description:
'issue description'
description:
'issue description'
}
}
}
}
}
end
let
(
:color
)
{
'#345'
}
let
(
:color
)
{
'#345'
}
...
...
spec/models/project_services/slack_service/merge_message_spec.rb
View file @
15a05be7
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
SlackService
::
MergeMessage
do
describe
SlackService
::
MergeMessage
do
subject
{
SlackService
::
MergeMessage
.
new
(
args
)
}
subject
{
SlackService
::
MergeMessage
.
new
(
args
)
}
let
(
:args
)
{
let
(
:args
)
do
{
{
user:
{
user:
{
name:
'Test User'
,
name:
'Test User'
,
...
@@ -24,7 +24,7 @@ describe SlackService::MergeMessage do
...
@@ -24,7 +24,7 @@ describe SlackService::MergeMessage do
target_branch:
'target_branch'
,
target_branch:
'target_branch'
,
}
}
}
}
}
end
let
(
:color
)
{
'#345'
}
let
(
:color
)
{
'#345'
}
...
...
spec/models/project_services/slack_service/push_message_spec.rb
View file @
15a05be7
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
SlackService
::
PushMessage
do
describe
SlackService
::
PushMessage
do
subject
{
SlackService
::
PushMessage
.
new
(
args
)
}
subject
{
SlackService
::
PushMessage
.
new
(
args
)
}
let
(
:args
)
{
let
(
:args
)
do
{
{
after:
'after'
,
after:
'after'
,
before:
'before'
,
before:
'before'
,
...
@@ -12,7 +12,7 @@ describe SlackService::PushMessage do
...
@@ -12,7 +12,7 @@ describe SlackService::PushMessage do
user_name:
'user_name'
,
user_name:
'user_name'
,
project_url:
'url'
project_url:
'url'
}
}
}
end
let
(
:color
)
{
'#345'
}
let
(
:color
)
{
'#345'
}
...
@@ -40,16 +40,16 @@ describe SlackService::PushMessage do
...
@@ -40,16 +40,16 @@ describe SlackService::PushMessage do
end
end
context
'tag push'
do
context
'tag push'
do
let
(
:args
)
{
let
(
:args
)
do
{
{
after:
'after'
,
after:
'after'
,
before:
Gitlab
::
Git
::
BLANK_SHA
,
before:
Gitlab
::
Git
::
BLANK_SHA
,
project_name:
'project_name'
,
project_name:
'project_name'
,
ref:
'refs/tags/new_tag'
,
ref:
'refs/tags/new_tag'
,
user_name:
'user_name'
,
user_name:
'user_name'
,
project_url:
'url'
project_url:
'url'
}
}
}
end
it
'returns a message regarding pushes'
do
it
'returns a message regarding pushes'
do
expect
(
subject
.
pretext
).
to
eq
(
'user_name pushed new tag '
\
expect
(
subject
.
pretext
).
to
eq
(
'user_name pushed new tag '
\
...
...
spec/models/service_spec.rb
View file @
15a05be7
...
@@ -68,9 +68,16 @@ describe Service do
...
@@ -68,9 +68,16 @@ describe Service do
describe
"Template"
do
describe
"Template"
do
describe
"for pushover service"
do
describe
"for pushover service"
do
let
(
:service_template
)
{
let
(
:service_template
)
do
PushoverService
.
create
(
template:
true
,
properties:
{
device:
'MyDevice'
,
sound:
'mic'
,
priority:
4
,
api_key:
'123456789'
})
PushoverService
.
create
(
}
template:
true
,
properties:
{
device:
'MyDevice'
,
sound:
'mic'
,
priority:
4
,
api_key:
'123456789'
})
end
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
describe
'should be prefilled for projects pushover service'
do
describe
'should be prefilled for projects pushover service'
do
...
...
spec/requests/api/files_spec.rb
View file @
15a05be7
...
@@ -39,14 +39,14 @@ describe API::API, api: true do
...
@@ -39,14 +39,14 @@ describe API::API, api: true do
end
end
describe
"POST /projects/:id/repository/files"
do
describe
"POST /projects/:id/repository/files"
do
let
(
:valid_params
)
{
let
(
:valid_params
)
do
{
{
file_path:
'newfile.rb'
,
file_path:
'newfile.rb'
,
branch_name:
'master'
,
branch_name:
'master'
,
content:
'puts 8'
,
content:
'puts 8'
,
commit_message:
'Added newfile'
commit_message:
'Added newfile'
}
}
}
end
it
"should create a new file in project repo"
do
it
"should create a new file in project repo"
do
post
api
(
"/projects/
#{
project
.
id
}
/repository/files"
,
user
),
valid_params
post
api
(
"/projects/
#{
project
.
id
}
/repository/files"
,
user
),
valid_params
...
@@ -70,14 +70,14 @@ describe API::API, api: true do
...
@@ -70,14 +70,14 @@ describe API::API, api: true do
end
end
describe
"PUT /projects/:id/repository/files"
do
describe
"PUT /projects/:id/repository/files"
do
let
(
:valid_params
)
{
let
(
:valid_params
)
do
{
{
file_path:
file_path
,
file_path:
file_path
,
branch_name:
'master'
,
branch_name:
'master'
,
content:
'puts 8'
,
content:
'puts 8'
,
commit_message:
'Changed file'
commit_message:
'Changed file'
}
}
}
end
it
"should update existing file in project repo"
do
it
"should update existing file in project repo"
do
put
api
(
"/projects/
#{
project
.
id
}
/repository/files"
,
user
),
valid_params
put
api
(
"/projects/
#{
project
.
id
}
/repository/files"
,
user
),
valid_params
...
@@ -92,13 +92,13 @@ describe API::API, api: true do
...
@@ -92,13 +92,13 @@ describe API::API, api: true do
end
end
describe
"DELETE /projects/:id/repository/files"
do
describe
"DELETE /projects/:id/repository/files"
do
let
(
:valid_params
)
{
let
(
:valid_params
)
do
{
{
file_path:
file_path
,
file_path:
file_path
,
branch_name:
'master'
,
branch_name:
'master'
,
commit_message:
'Changed file'
commit_message:
'Changed file'
}
}
}
end
it
"should delete existing file in project repo"
do
it
"should delete existing file in project repo"
do
delete
api
(
"/projects/
#{
project
.
id
}
/repository/files"
,
user
),
valid_params
delete
api
(
"/projects/
#{
project
.
id
}
/repository/files"
,
user
),
valid_params
...
...
spec/requests/api/fork_spec.rb
View file @
15a05be7
...
@@ -6,15 +6,14 @@ describe API::API, api: true do
...
@@ -6,15 +6,14 @@ describe API::API, api: true do
let
(
:user2
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:user3
)
{
create
(
:user
)
}
let
(
:user3
)
{
create
(
:user
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
,
let
(
:project
)
do
namespace:
user
.
namespace
)
create
(
:project
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
end
let
(
:project_user2
)
{
create
(
:project_member
,
user:
user2
,
let
(
:project_user2
)
do
project:
project
,
create
(
:project_member
,
user:
user2
,
project:
project
,
access_level:
ProjectMember
::
GUEST
)
access_level:
ProjectMember
::
GUEST
)
end
}
describe
'POST /projects/fork/:id'
do
describe
'POST /projects/fork/:id'
do
before
{
project_user2
}
before
{
project_user2
}
...
...
spec/requests/api/group_members_spec.rb
View file @
15a05be7
...
@@ -61,10 +61,9 @@ describe API::API, api: true do
...
@@ -61,10 +61,9 @@ describe API::API, api: true do
it
"should return ok and add new member"
do
it
"should return ok and add new member"
do
new_user
=
create
(
:user
)
new_user
=
create
(
:user
)
expect
{
expect
do
post
api
(
"/groups/
#{
group_no_members
.
id
}
/members"
,
owner
),
post
api
(
"/groups/
#{
group_no_members
.
id
}
/members"
,
owner
),
user_id:
new_user
.
id
,
access_level:
GroupMember
::
MASTER
user_id:
new_user
.
id
,
access_level:
GroupMember
::
MASTER
end
.
to
change
{
group_no_members
.
members
.
count
}.
by
(
1
)
}.
to
change
{
group_no_members
.
members
.
count
}.
by
(
1
)
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
json_response
[
'name'
]).
to
eq
(
new_user
.
name
)
expect
(
json_response
[
'name'
]).
to
eq
(
new_user
.
name
)
...
@@ -74,10 +73,9 @@ describe API::API, api: true do
...
@@ -74,10 +73,9 @@ describe API::API, api: true do
it
"should not allow guest to modify group members"
do
it
"should not allow guest to modify group members"
do
new_user
=
create
(
:user
)
new_user
=
create
(
:user
)
expect
{
expect
do
post
api
(
"/groups/
#{
group_with_members
.
id
}
/members"
,
guest
),
post
api
(
"/groups/
#{
group_with_members
.
id
}
/members"
,
guest
),
user_id:
new_user
.
id
,
access_level:
GroupMember
::
MASTER
user_id:
new_user
.
id
,
access_level:
GroupMember
::
MASTER
end
.
not_to
change
{
group_with_members
.
members
.
count
}
}.
not_to
change
{
group_with_members
.
members
.
count
}
expect
(
response
.
status
).
to
eq
(
403
)
expect
(
response
.
status
).
to
eq
(
403
)
end
end
...
@@ -178,9 +176,9 @@ describe API::API, api: true do
...
@@ -178,9 +176,9 @@ describe API::API, api: true do
context
"when a member of the group"
do
context
"when a member of the group"
do
it
"should delete guest's membership of group"
do
it
"should delete guest's membership of group"
do
expect
{
expect
do
delete
api
(
"/groups/
#{
group_with_members
.
id
}
/members/
#{
guest
.
id
}
"
,
owner
)
delete
api
(
"/groups/
#{
group_with_members
.
id
}
/members/
#{
guest
.
id
}
"
,
owner
)
}
.
to
change
{
group_with_members
.
members
.
count
}.
by
(
-
1
)
end
.
to
change
{
group_with_members
.
members
.
count
}.
by
(
-
1
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
end
end
...
...
spec/requests/api/merge_requests_spec.rb
View file @
15a05be7
...
@@ -8,9 +8,10 @@ describe API::API, api: true do
...
@@ -8,9 +8,10 @@ describe API::API, api: true do
let!
(
:merge_request_closed
)
{
create
(
:merge_request
,
state:
"closed"
,
author:
user
,
assignee:
user
,
source_project:
project
,
target_project:
project
,
title:
"Closed test"
)
}
let!
(
:merge_request_closed
)
{
create
(
:merge_request
,
state:
"closed"
,
author:
user
,
assignee:
user
,
source_project:
project
,
target_project:
project
,
title:
"Closed test"
)
}
let!
(
:merge_request_merged
)
{
create
(
:merge_request
,
state:
"merged"
,
author:
user
,
assignee:
user
,
source_project:
project
,
target_project:
project
,
title:
"Merged test"
)
}
let!
(
:merge_request_merged
)
{
create
(
:merge_request
,
state:
"merged"
,
author:
user
,
assignee:
user
,
source_project:
project
,
target_project:
project
,
title:
"Merged test"
)
}
let!
(
:note
)
{
create
(
:note_on_merge_request
,
author:
user
,
project:
project
,
noteable:
merge_request
,
note:
"a comment on a MR"
)
}
let!
(
:note
)
{
create
(
:note_on_merge_request
,
author:
user
,
project:
project
,
noteable:
merge_request
,
note:
"a comment on a MR"
)
}
before
{
before
do
project
.
team
<<
[
user
,
:reporters
]
project
.
team
<<
[
user
,
:reporters
]
}
end
describe
"GET /projects/:id/merge_requests"
do
describe
"GET /projects/:id/merge_requests"
do
context
"when unauthenticated"
do
context
"when unauthenticated"
do
...
...
spec/requests/api/project_hooks_spec.rb
View file @
15a05be7
...
@@ -61,10 +61,9 @@ describe API::API, 'ProjectHooks', api: true do
...
@@ -61,10 +61,9 @@ describe API::API, 'ProjectHooks', api: true do
describe
"POST /projects/:id/hooks"
do
describe
"POST /projects/:id/hooks"
do
it
"should add hook to project"
do
it
"should add hook to project"
do
expect
{
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/hooks"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/hooks"
,
user
),
url:
"http://example.com"
,
issues_events:
true
url:
"http://example.com"
,
issues_events:
true
end
.
to
change
{
project
.
hooks
.
count
}.
by
(
1
)
}.
to
change
{
project
.
hooks
.
count
}.
by
(
1
)
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
.
status
).
to
eq
(
201
)
end
end
...
@@ -105,9 +104,9 @@ describe API::API, 'ProjectHooks', api: true do
...
@@ -105,9 +104,9 @@ describe API::API, 'ProjectHooks', api: true do
describe
"DELETE /projects/:id/hooks/:hook_id"
do
describe
"DELETE /projects/:id/hooks/:hook_id"
do
it
"should delete hook from project"
do
it
"should delete hook from project"
do
expect
{
expect
do
delete
api
(
"/projects/
#{
project
.
id
}
/hooks/
#{
hook
.
id
}
"
,
user
)
delete
api
(
"/projects/
#{
project
.
id
}
/hooks/
#{
hook
.
id
}
"
,
user
)
}
.
to
change
{
project
.
hooks
.
count
}.
by
(
-
1
)
end
.
to
change
{
project
.
hooks
.
count
}.
by
(
-
1
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
end
end
...
...
spec/requests/api/project_members_spec.rb
View file @
15a05be7
...
@@ -53,10 +53,9 @@ describe API::API, api: true do
...
@@ -53,10 +53,9 @@ describe API::API, api: true do
describe
"POST /projects/:id/members"
do
describe
"POST /projects/:id/members"
do
it
"should add user to project team"
do
it
"should add user to project team"
do
expect
{
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/members"
,
user
),
user_id:
user2
.
id
,
post
api
(
"/projects/
#{
project
.
id
}
/members"
,
user
),
user_id:
user2
.
id
,
access_level:
ProjectMember
::
DEVELOPER
access_level:
ProjectMember
::
DEVELOPER
end
.
to
change
{
ProjectMember
.
count
}.
by
(
1
)
}.
to
change
{
ProjectMember
.
count
}.
by
(
1
)
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
json_response
[
'username'
]).
to
eq
(
user2
.
username
)
expect
(
json_response
[
'username'
]).
to
eq
(
user2
.
username
)
...
@@ -66,10 +65,9 @@ describe API::API, api: true do
...
@@ -66,10 +65,9 @@ describe API::API, api: true do
it
"should return a 201 status if user is already project member"
do
it
"should return a 201 status if user is already project member"
do
post
api
(
"/projects/
#{
project
.
id
}
/members"
,
user
),
user_id:
user2
.
id
,
post
api
(
"/projects/
#{
project
.
id
}
/members"
,
user
),
user_id:
user2
.
id
,
access_level:
ProjectMember
::
DEVELOPER
access_level:
ProjectMember
::
DEVELOPER
expect
{
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/members"
,
user
),
user_id:
user2
.
id
,
post
api
(
"/projects/
#{
project
.
id
}
/members"
,
user
),
user_id:
user2
.
id
,
access_level:
ProjectMember
::
DEVELOPER
access_level:
ProjectMember
::
DEVELOPER
end
.
not_to
change
{
ProjectMember
.
count
}
}.
not_to
change
{
ProjectMember
.
count
}
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
json_response
[
'username'
]).
to
eq
(
user2
.
username
)
expect
(
json_response
[
'username'
]).
to
eq
(
user2
.
username
)
...
@@ -123,16 +121,16 @@ describe API::API, api: true do
...
@@ -123,16 +121,16 @@ describe API::API, api: true do
before
{
project_member2
}
before
{
project_member2
}
it
"should remove user from project team"
do
it
"should remove user from project team"
do
expect
{
expect
do
delete
api
(
"/projects/
#{
project
.
id
}
/members/
#{
user3
.
id
}
"
,
user
)
delete
api
(
"/projects/
#{
project
.
id
}
/members/
#{
user3
.
id
}
"
,
user
)
}
.
to
change
{
ProjectMember
.
count
}.
by
(
-
1
)
end
.
to
change
{
ProjectMember
.
count
}.
by
(
-
1
)
end
end
it
"should return 200 if team member is not part of a project"
do
it
"should return 200 if team member is not part of a project"
do
delete
api
(
"/projects/
#{
project
.
id
}
/members/
#{
user3
.
id
}
"
,
user
)
delete
api
(
"/projects/
#{
project
.
id
}
/members/
#{
user3
.
id
}
"
,
user
)
expect
{
expect
do
delete
api
(
"/projects/
#{
project
.
id
}
/members/
#{
user3
.
id
}
"
,
user
)
delete
api
(
"/projects/
#{
project
.
id
}
/members/
#{
user3
.
id
}
"
,
user
)
}
.
to_not
change
{
ProjectMember
.
count
}
end
.
to_not
change
{
ProjectMember
.
count
}
end
end
it
"should return 200 if team member already removed"
do
it
"should return 200 if team member already removed"
do
...
@@ -142,9 +140,9 @@ describe API::API, api: true do
...
@@ -142,9 +140,9 @@ describe API::API, api: true do
end
end
it
"should return 200 OK when the user was not member"
do
it
"should return 200 OK when the user was not member"
do
expect
{
expect
do
delete
api
(
"/projects/
#{
project
.
id
}
/members/1000000"
,
user
)
delete
api
(
"/projects/
#{
project
.
id
}
/members/1000000"
,
user
)
}
.
to
change
{
ProjectMember
.
count
}.
by
(
0
)
end
.
to
change
{
ProjectMember
.
count
}.
by
(
0
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'message'
]).
to
eq
(
"Access revoked"
)
expect
(
json_response
[
'message'
]).
to
eq
(
"Access revoked"
)
expect
(
json_response
[
'id'
]).
to
eq
(
1000000
)
expect
(
json_response
[
'id'
]).
to
eq
(
1000000
)
...
...
spec/services/archive_repository_service_spec.rb
View file @
15a05be7
...
@@ -17,9 +17,7 @@ describe ArchiveRepositoryService do
...
@@ -17,9 +17,7 @@ describe ArchiveRepositoryService do
end
end
it
"raises an error"
do
it
"raises an error"
do
expect
{
expect
{
subject
.
execute
(
timeout:
0.0
)
}.
to
raise_error
subject
.
execute
(
timeout:
0.0
)
}.
to
raise_error
end
end
end
end
...
...
spec/services/git_push_service_spec.rb
View file @
15a05be7
...
@@ -218,18 +218,18 @@ describe GitPushService do
...
@@ -218,18 +218,18 @@ describe GitPushService do
end
end
it
"doesn't create cross-reference notes for a closing reference"
do
it
"doesn't create cross-reference notes for a closing reference"
do
expect
{
expect
do
service
.
execute
(
project
,
user
,
@oldrev
,
@newrev
,
@ref
)
service
.
execute
(
project
,
user
,
@oldrev
,
@newrev
,
@ref
)
}
.
not_to
change
{
Note
.
where
(
project_id:
project
.
id
,
system:
true
,
commit_id:
closing_commit
.
id
).
count
}
end
.
not_to
change
{
Note
.
where
(
project_id:
project
.
id
,
system:
true
,
commit_id:
closing_commit
.
id
).
count
}
end
end
it
"doesn't close issues when pushed to non-default branches"
do
it
"doesn't close issues when pushed to non-default branches"
do
project
.
stub
(
default_branch:
'durf'
)
project
.
stub
(
default_branch:
'durf'
)
# The push still shouldn't create cross-reference notes.
# The push still shouldn't create cross-reference notes.
expect
{
expect
do
service
.
execute
(
project
,
user
,
@oldrev
,
@newrev
,
'refs/heads/hurf'
)
service
.
execute
(
project
,
user
,
@oldrev
,
@newrev
,
'refs/heads/hurf'
)
}
.
not_to
change
{
Note
.
where
(
project_id:
project
.
id
,
system:
true
).
count
}
end
.
not_to
change
{
Note
.
where
(
project_id:
project
.
id
,
system:
true
).
count
}
expect
(
Issue
.
find
(
issue
.
id
)).
to
be_opened
expect
(
Issue
.
find
(
issue
.
id
)).
to
be_opened
end
end
...
@@ -238,9 +238,9 @@ describe GitPushService do
...
@@ -238,9 +238,9 @@ describe GitPushService do
allow
(
project
).
to
receive
(
:default_issues_tracker?
).
and_return
(
false
)
allow
(
project
).
to
receive
(
:default_issues_tracker?
).
and_return
(
false
)
# The push still shouldn't create cross-reference notes.
# The push still shouldn't create cross-reference notes.
expect
{
expect
do
service
.
execute
(
project
,
user
,
@oldrev
,
@newrev
,
'refs/heads/hurf'
)
service
.
execute
(
project
,
user
,
@oldrev
,
@newrev
,
'refs/heads/hurf'
)
}
.
not_to
change
{
Note
.
where
(
project_id:
project
.
id
,
system:
true
).
count
}
end
.
not_to
change
{
Note
.
where
(
project_id:
project
.
id
,
system:
true
).
count
}
end
end
end
end
...
...
spec/services/issues/bulk_update_service_spec.rb
View file @
15a05be7
require
'spec_helper'
require
'spec_helper'
describe
Issues
::
BulkUpdateService
do
describe
Issues
::
BulkUpdateService
do
let
(
:issue
)
{
let
(
:issue
)
{
create
(
:issue
,
project:
@project
)
}
create
(
:issue
,
project:
@project
)
}
before
do
before
do
@user
=
create
:user
@user
=
create
:user
...
@@ -26,14 +24,14 @@ describe Issues::BulkUpdateService do
...
@@ -26,14 +24,14 @@ describe Issues::BulkUpdateService do
}
}
end
end
it
{
it
do
result
=
Issues
::
BulkUpdateService
.
new
(
@project
,
@user
,
@params
).
execute
result
=
Issues
::
BulkUpdateService
.
new
(
@project
,
@user
,
@params
).
execute
expect
(
result
[
:success
]).
to
be_truthy
expect
(
result
[
:success
]).
to
be_truthy
expect
(
result
[
:count
]).
to
eq
(
@issues
.
count
)
expect
(
result
[
:count
]).
to
eq
(
@issues
.
count
)
expect
(
@project
.
issues
.
opened
).
to
be_empty
expect
(
@project
.
issues
.
opened
).
to
be_empty
expect
(
@project
.
issues
.
closed
).
not_to
be_empty
expect
(
@project
.
issues
.
closed
).
not_to
be_empty
}
end
end
end
...
@@ -49,14 +47,14 @@ describe Issues::BulkUpdateService do
...
@@ -49,14 +47,14 @@ describe Issues::BulkUpdateService do
}
}
end
end
it
{
it
do
result
=
Issues
::
BulkUpdateService
.
new
(
@project
,
@user
,
@params
).
execute
result
=
Issues
::
BulkUpdateService
.
new
(
@project
,
@user
,
@params
).
execute
expect
(
result
[
:success
]).
to
be_truthy
expect
(
result
[
:success
]).
to
be_truthy
expect
(
result
[
:count
]).
to
eq
(
@issues
.
count
)
expect
(
result
[
:count
]).
to
eq
(
@issues
.
count
)
expect
(
@project
.
issues
.
closed
).
to
be_empty
expect
(
@project
.
issues
.
closed
).
to
be_empty
expect
(
@project
.
issues
.
opened
).
not_to
be_empty
expect
(
@project
.
issues
.
opened
).
not_to
be_empty
}
end
end
end
...
@@ -70,13 +68,13 @@ describe Issues::BulkUpdateService do
...
@@ -70,13 +68,13 @@ describe Issues::BulkUpdateService do
}
}
end
end
it
{
it
do
result
=
Issues
::
BulkUpdateService
.
new
(
@project
,
@user
,
@params
).
execute
result
=
Issues
::
BulkUpdateService
.
new
(
@project
,
@user
,
@params
).
execute
expect
(
result
[
:success
]).
to
be_truthy
expect
(
result
[
:success
]).
to
be_truthy
expect
(
result
[
:count
]).
to
eq
(
1
)
expect
(
result
[
:count
]).
to
eq
(
1
)
expect
(
@project
.
issues
.
first
.
assignee
).
to
eq
(
@new_assignee
)
expect
(
@project
.
issues
.
first
.
assignee
).
to
eq
(
@new_assignee
)
}
end
it
'allows mass-unassigning'
do
it
'allows mass-unassigning'
do
@project
.
issues
.
first
.
update_attribute
(
:assignee
,
@new_assignee
)
@project
.
issues
.
first
.
update_attribute
(
:assignee
,
@new_assignee
)
...
@@ -109,13 +107,13 @@ describe Issues::BulkUpdateService do
...
@@ -109,13 +107,13 @@ describe Issues::BulkUpdateService do
}
}
end
end
it
{
it
do
result
=
Issues
::
BulkUpdateService
.
new
(
@project
,
@user
,
@params
).
execute
result
=
Issues
::
BulkUpdateService
.
new
(
@project
,
@user
,
@params
).
execute
expect
(
result
[
:success
]).
to
be_truthy
expect
(
result
[
:success
]).
to
be_truthy
expect
(
result
[
:count
]).
to
eq
(
1
)
expect
(
result
[
:count
]).
to
eq
(
1
)
expect
(
@project
.
issues
.
first
.
milestone
).
to
eq
(
@milestone
)
expect
(
@project
.
issues
.
first
.
milestone
).
to
eq
(
@milestone
)
}
end
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