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
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
Show 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
describe
"POST create"
do
render_views
before
{
before
do
post
:create
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
branch_name:
branch
,
ref:
ref
}
end
context
"valid branch name, valid source"
do
let
(
:branch
)
{
"merge_branch"
}
...
...
spec/controllers/import/bitbucket_controller_spec.rb
View file @
15a05be7
...
...
@@ -57,20 +57,13 @@ describe Import::BitbucketController do
describe
"POST create"
do
let
(
:bitbucket_username
)
{
user
.
username
}
let
(
:bitbucket_user
)
{
{
user:
{
username:
bitbucket_username
}
}.
with_indifferent_access
}
let
(
:bitbucket_repo
)
{
{
slug:
"vim"
,
owner:
bitbucket_username
}.
with_indifferent_access
}
let
(
:bitbucket_user
)
do
{
user:
{
username:
bitbucket_username
}
}.
with_indifferent_access
end
let
(
:bitbucket_repo
)
do
{
slug:
"vim"
,
owner:
bitbucket_username
}.
with_indifferent_access
end
before
do
allow
(
Gitlab
::
BitbucketImport
::
KeyAdder
).
...
...
spec/controllers/import/github_controller_spec.rb
View file @
15a05be7
...
...
@@ -57,14 +57,14 @@ describe Import::GithubController do
describe
"POST create"
do
let
(
:github_username
)
{
user
.
username
}
let
(
:github_
user
)
{
OpenStruct
.
new
(
login:
github_username
)
}
let
(
:github_repo
)
{
OpenStruct
.
new
(
name:
'vim'
,
full_name:
"
#{
github_username
}
/vim"
,
owner:
OpenStruct
.
new
(
login:
github_username
)
)
}
let
(
:github_user
)
{
OpenStruct
.
new
(
login:
github_username
)
}
let
(
:github_
repo
)
do
OpenStruct
.
new
(
name:
'vim'
,
full_name:
"
#{
github_username
}
/vim"
,
owner:
OpenStruct
.
new
(
login:
github_username
)
)
end
before
do
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
describe
"POST create"
do
let
(
:gitlab_username
)
{
user
.
username
}
let
(
:gitlab_user
)
{
{
username:
gitlab_username
}.
with_indifferent_access
}
let
(
:gitlab_repo
)
{
let
(
:gitlab_user
)
do
{
username:
gitlab_username
}.
with_indifferent_access
end
let
(
:gitlab_repo
)
do
{
path:
'vim'
,
path_with_namespace:
"
#{
gitlab_username
}
/vim"
,
owner:
{
name:
gitlab_username
},
namespace:
{
path:
gitlab_username
}
}.
with_indifferent_access
}
end
before
do
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
end
it
'does not change issue count'
do
expect
{
click_button
'Save changes'
}.
to_not
change
{
Issue
.
count
}
expect
{
click_button
'Save changes'
}.
to_not
change
{
Issue
.
count
}
end
it
'should update issue fields'
do
...
...
spec/helpers/tree_helper_spec.rb
View file @
15a05be7
...
...
@@ -4,10 +4,9 @@ describe TreeHelper do
describe
'flatten_tree'
do
let
(
:project
)
{
create
(
:project
)
}
before
{
@repository
=
project
.
repository
@commit
=
project
.
commit
(
"e56497bb"
)
}
before
do
@repository
=
project
.
repository
@commit
=
project
.
commit
(
"e56497bb"
)
end
context
"on a directory containing more than one file/directory"
do
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
it
'should not send emails'
do
allow
(
Gitlab
.
config
.
gitlab
).
to
receive
(
:email_enabled
).
and_return
(
false
)
expect
{
deliver_mail
}.
not_to
change
(
ActionMailer
::
Base
.
deliveries
,
:count
)
expect
{
deliver_mail
}.
not_to
change
(
ActionMailer
::
Base
.
deliveries
,
:count
)
end
after
do
...
...
spec/lib/file_size_validator_spec.rb
View file @
15a05be7
...
...
@@ -22,8 +22,13 @@ describe 'Gitlab::FileSizeValidatorSpec' do
end
describe
'options uses a symbol'
do
let
(
:options
)
{
{
maximum: :test
,
attributes:
{
attachment:
attachment
}
}
}
let
(
:options
)
do
{
maximum: :test
,
attributes:
{
attachment:
attachment
}
}
end
before
do
allow
(
note
).
to
receive
(
:test
)
{
10
}
end
...
...
spec/lib/gitlab/backend/grack_auth_spec.rb
View file @
15a05be7
...
...
@@ -6,13 +6,13 @@ describe Grack::Auth do
let
(
:app
)
{
lambda
{
|
env
|
[
200
,
{},
"Success!"
]
}
}
let!
(
:auth
)
{
Grack
::
Auth
.
new
(
app
)
}
let
(
:env
)
{
let
(
:env
)
do
{
"rack.input"
=>
""
,
"REQUEST_METHOD"
=>
"GET"
,
"QUERY_STRING"
=>
"service=git-upload-pack"
}
'rack.input'
=>
''
,
'REQUEST_METHOD'
=>
'GET'
,
'QUERY_STRING'
=>
'service=git-upload-pack'
}
end
let
(
:status
)
{
auth
.
call
(
env
).
first
}
describe
"#call"
do
...
...
spec/lib/gitlab/bitbucket_import/project_creator_spec.rb
View file @
15a05be7
...
...
@@ -2,12 +2,14 @@ require 'spec_helper'
describe
Gitlab
::
BitbucketImport
::
ProjectCreator
do
let
(
:user
)
{
create
(
:user
,
bitbucket_access_token:
"asdffg"
,
bitbucket_access_token_secret:
"sekret"
)
}
let
(
:repo
)
{
{
let
(
:repo
)
do
{
name:
'Vim'
,
slug:
'vim'
,
is_private:
true
,
owner:
"asd"
}.
with_indifferent_access
}
owner:
"asd"
}.
with_indifferent_access
end
let
(
:namespace
){
create
(
:group
,
owner:
user
)
}
before
do
...
...
spec/lib/gitlab/github_import/project_creator_spec.rb
View file @
15a05be7
...
...
@@ -2,14 +2,16 @@ require 'spec_helper'
describe
Gitlab
::
GithubImport
::
ProjectCreator
do
let
(
:user
)
{
create
(
:user
,
github_access_token:
"asdffg"
)
}
let
(
:repo
)
{
OpenStruct
.
new
(
let
(
:repo
)
do
OpenStruct
.
new
(
login:
'vim'
,
name:
'vim'
,
private:
true
,
full_name:
'asd/vim'
,
clone_url:
"https://gitlab.com/asd/vim.git"
,
owner:
OpenStruct
.
new
(
login:
"john"
))
}
owner:
OpenStruct
.
new
(
login:
"john"
)
)
end
let
(
:namespace
){
create
(
:group
,
owner:
user
)
}
before
do
...
...
spec/lib/gitlab/gitlab_import/project_creator_spec.rb
View file @
15a05be7
...
...
@@ -2,14 +2,16 @@ require 'spec_helper'
describe
Gitlab
::
GitlabImport
::
ProjectCreator
do
let
(
:user
)
{
create
(
:user
,
gitlab_access_token:
"asdffg"
)
}
let
(
:repo
)
{
{
let
(
:repo
)
do
{
name:
'vim'
,
path:
'vim'
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PRIVATE
,
path_with_namespace:
'asd/vim'
,
http_url_to_repo:
"https://gitlab.com/asd/vim.git"
,
owner:
{
name:
"john"
}
}.
with_indifferent_access
}
owner:
{
name:
"john"
}
}.
with_indifferent_access
end
let
(
:namespace
){
create
(
:group
,
owner:
user
)
}
before
do
...
...
spec/lib/gitlab/google_code_import/importer_spec.rb
View file @
15a05be7
...
...
@@ -4,15 +4,14 @@ describe Gitlab::GoogleCodeImport::Importer do
let
(
:mapped_user
)
{
create
(
:user
,
username:
"thilo123"
)
}
let
(
:raw_data
)
{
JSON
.
parse
(
File
.
read
(
Rails
.
root
.
join
(
"spec/fixtures/GoogleCodeProjectHosting.json"
)))
}
let
(
:client
)
{
Gitlab
::
GoogleCodeImport
::
Client
.
new
(
raw_data
)
}
let
(
:import_data
)
{
let
(
:import_data
)
do
{
"repo"
=>
client
.
repo
(
"tint2"
).
raw_data
,
"user_map"
=>
{
"thilo..."
=>
"@
#{
mapped_user
.
username
}
"
}
}
'repo'
=>
client
.
repo
(
'tint2'
).
raw_data
,
'user_map'
=>
{
'thilo...'
=>
"@
#{
mapped_user
.
username
}
"
}
}
end
let
(
:project
)
{
create
(
:project
)
}
subject
{
described_class
.
new
(
project
)
}
before
do
...
...
spec/lib/gitlab/google_code_import/project_creator_spec.rb
View file @
15a05be7
...
...
@@ -2,13 +2,13 @@ require 'spec_helper'
describe
Gitlab
::
GoogleCodeImport
::
ProjectCreator
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:repo
)
{
let
(
:repo
)
do
Gitlab
::
GoogleCodeImport
::
Repository
.
new
(
"name"
=>
'vim'
,
"summary"
=>
'VI Improved'
,
"repositoryUrls"
=>
[
"https://vim.googlecode.com/git/"
]
"repositoryUrls"
=>
[
"https://vim.googlecode.com/git/"
]
)
}
end
let
(
:namespace
){
create
(
:group
,
owner:
user
)
}
before
do
...
...
spec/lib/gitlab/o_auth/auth_hash_spec.rb
View file @
15a05be7
...
...
@@ -11,9 +11,9 @@ describe Gitlab::OAuth::AuthHash do
)
end
let
(
:uid_raw
)
{
let
(
:uid_raw
)
do
"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
(
:nickname_raw
)
{
"ok
\xC3\xBC\xC3\xA7\xC3\xBC
k"
}
let
(
:first_name_raw
)
{
'Onur'
}
...
...
@@ -34,7 +34,7 @@ describe Gitlab::OAuth::AuthHash do
let
(
:nickname_utf8
)
{
nickname_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
,
first_name:
first_name_ascii
,
...
...
@@ -43,7 +43,7 @@ describe Gitlab::OAuth::AuthHash do
nickname:
nickname_ascii
,
uid:
uid_ascii
}
}
end
context
'defaults'
do
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
#These must happen in the context of the satellite directory...
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
satellite_action
.
send
(
:prepare_satellite!
,
repo
)
}
end
#verify it's clean
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
describe
'#can_be_merged?'
do
context
'on fork'
do
it
{
expect
(
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request_fork
.
author
,
merge_request_fork
).
can_be_merged?
).
to
be_truthy
}
it
do
expect
(
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request_fork
.
author
,
merge_request_fork
).
can_be_merged?
).
to
be_truthy
end
it
{
expect
(
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request_fork_with_conflict
.
author
,
merge_request_fork_with_conflict
).
can_be_merged?
).
to
be_falsey
}
it
do
expect
(
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request_fork_with_conflict
.
author
,
merge_request_fork_with_conflict
).
can_be_merged?
).
to
be_falsey
end
end
context
'between branches'
do
it
{
expect
(
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request
.
author
,
merge_request
).
can_be_merged?
).
to
be_truthy
}
it
do
expect
(
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request
.
author
,
merge_request
).
can_be_merged?
).
to
be_truthy
end
it
{
expect
(
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request_with_conflict
.
author
,
merge_request_with_conflict
).
can_be_merged?
).
to
be_falsey
}
it
do
expect
(
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request_with_conflict
.
author
,
merge_request_with_conflict
).
can_be_merged?
).
to
be_falsey
end
end
end
end
spec/mailers/notify_spec.rb
View file @
15a05be7
...
...
@@ -418,9 +418,7 @@ describe Notify do
describe
'project access changed'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project_member
)
{
create
(
:project_member
,
project:
project
,
user:
user
)
}
let
(
:project_member
)
{
create
(
:project_member
,
project:
project
,
user:
user
)
}
subject
{
Notify
.
project_access_granted_email
(
project_member
.
id
)
}
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
it
"destroys the deploy key"
do
subject
.
destroy
expect
{
deploy_key
.
reload
}.
to
raise_error
(
ActiveRecord
::
RecordNotFound
)
expect
{
deploy_key
.
reload
}.
to
raise_error
(
ActiveRecord
::
RecordNotFound
)
end
end
end
...
...
spec/models/hooks/service_hook_spec.rb
View file @
15a05be7
...
...
@@ -50,9 +50,7 @@ describe ServiceHook do
it
"catches exceptions"
do
expect
(
WebHook
).
to
receive
(
:post
).
and_raise
(
"Some HTTP Post error"
)
expect
{
@service_hook
.
execute
(
@data
)
}.
to
raise_error
expect
{
@service_hook
.
execute
(
@data
)
}.
to
raise_error
end
end
end
spec/models/hooks/web_hook_spec.rb
View file @
15a05be7
...
...
@@ -71,9 +71,7 @@ describe ProjectHook do
it
"catches exceptions"
do
expect
(
WebHook
).
to
receive
(
:post
).
and_raise
(
"Some HTTP Post error"
)
expect
{
@project_hook
.
execute
(
@data
,
'push_hooks'
)
}.
to
raise_error
expect
{
@project_hook
.
execute
(
@data
,
'push_hooks'
)
}.
to
raise_error
end
end
end
spec/models/project_services/slack_service/issue_message_spec.rb
View file @
15a05be7
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
SlackService
::
IssueMessage
do
subject
{
SlackService
::
IssueMessage
.
new
(
args
)
}
let
(
:args
)
{
let
(
:args
)
do
{
user:
{
name:
'Test User'
,
...
...
@@ -23,7 +23,7 @@ describe SlackService::IssueMessage do
description:
'issue description'
}
}
}
end
let
(
:color
)
{
'#345'
}
...
...
spec/models/project_services/slack_service/merge_message_spec.rb
View file @
15a05be7
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
SlackService
::
MergeMessage
do
subject
{
SlackService
::
MergeMessage
.
new
(
args
)
}
let
(
:args
)
{
let
(
:args
)
do
{
user:
{
name:
'Test User'
,
...
...
@@ -24,7 +24,7 @@ describe SlackService::MergeMessage do
target_branch:
'target_branch'
,
}
}
}
end
let
(
:color
)
{
'#345'
}
...
...
spec/models/project_services/slack_service/push_message_spec.rb
View file @
15a05be7
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
SlackService
::
PushMessage
do
subject
{
SlackService
::
PushMessage
.
new
(
args
)
}
let
(
:args
)
{
let
(
:args
)
do
{
after:
'after'
,
before:
'before'
,
...
...
@@ -12,7 +12,7 @@ describe SlackService::PushMessage do
user_name:
'user_name'
,
project_url:
'url'
}
}
end
let
(
:color
)
{
'#345'
}
...
...
@@ -40,7 +40,7 @@ describe SlackService::PushMessage do
end
context
'tag push'
do
let
(
:args
)
{
let
(
:args
)
do
{
after:
'after'
,
before:
Gitlab
::
Git
::
BLANK_SHA
,
...
...
@@ -49,7 +49,7 @@ describe SlackService::PushMessage do
user_name:
'user_name'
,
project_url:
'url'
}
}
end
it
'returns a message regarding pushes'
do
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
describe
"Template"
do
describe
"for pushover service"
do
let
(
:service_template
)
{
PushoverService
.
create
(
template:
true
,
properties:
{
device:
'MyDevice'
,
sound:
'mic'
,
priority:
4
,
api_key:
'123456789'
})
}
let
(
:service_template
)
do
PushoverService
.
create
(
template:
true
,
properties:
{
device:
'MyDevice'
,
sound:
'mic'
,
priority:
4
,
api_key:
'123456789'
})
end
let
(
:project
)
{
create
(
:project
)
}
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
end
describe
"POST /projects/:id/repository/files"
do
let
(
:valid_params
)
{
let
(
:valid_params
)
do
{
file_path:
'newfile.rb'
,
branch_name:
'master'
,
content:
'puts 8'
,
commit_message:
'Added newfile'
}
}
end
it
"should create a new file in project repo"
do
post
api
(
"/projects/
#{
project
.
id
}
/repository/files"
,
user
),
valid_params
...
...
@@ -70,14 +70,14 @@ describe API::API, api: true do
end
describe
"PUT /projects/:id/repository/files"
do
let
(
:valid_params
)
{
let
(
:valid_params
)
do
{
file_path:
file_path
,
branch_name:
'master'
,
content:
'puts 8'
,
commit_message:
'Changed file'
}
}
end
it
"should update existing file in project repo"
do
put
api
(
"/projects/
#{
project
.
id
}
/repository/files"
,
user
),
valid_params
...
...
@@ -92,13 +92,13 @@ describe API::API, api: true do
end
describe
"DELETE /projects/:id/repository/files"
do
let
(
:valid_params
)
{
let
(
:valid_params
)
do
{
file_path:
file_path
,
branch_name:
'master'
,
commit_message:
'Changed file'
}
}
end
it
"should delete existing file in project repo"
do
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
let
(
:user2
)
{
create
(
:user
)
}
let
(
:user3
)
{
create
(
:user
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
let
(
:project_user2
)
{
create
(
:project_member
,
user:
user2
,
project:
project
,
access_level:
ProjectMember
::
GUEST
)
}
let
(
:project
)
do
create
(
:project
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
end
let
(
:project_user2
)
do
create
(
:project_member
,
user:
user2
,
project:
project
,
access_level:
ProjectMember
::
GUEST
)
end
describe
'POST /projects/fork/:id'
do
before
{
project_user2
}
...
...
spec/requests/api/group_members_spec.rb
View file @
15a05be7
...
...
@@ -61,10 +61,9 @@ describe API::API, api: true do
it
"should return ok and add new member"
do
new_user
=
create
(
:user
)
expect
{
post
api
(
"/groups/
#{
group_no_members
.
id
}
/members"
,
owner
),
user_id:
new_user
.
id
,
access_level:
GroupMember
::
MASTER
}.
to
change
{
group_no_members
.
members
.
count
}.
by
(
1
)
expect
do
post
api
(
"/groups/
#{
group_no_members
.
id
}
/members"
,
owner
),
user_id:
new_user
.
id
,
access_level:
GroupMember
::
MASTER
end
.
to
change
{
group_no_members
.
members
.
count
}.
by
(
1
)
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
json_response
[
'name'
]).
to
eq
(
new_user
.
name
)
...
...
@@ -74,10 +73,9 @@ describe API::API, api: true do
it
"should not allow guest to modify group members"
do
new_user
=
create
(
:user
)
expect
{
post
api
(
"/groups/
#{
group_with_members
.
id
}
/members"
,
guest
),
user_id:
new_user
.
id
,
access_level:
GroupMember
::
MASTER
}.
not_to
change
{
group_with_members
.
members
.
count
}
expect
do
post
api
(
"/groups/
#{
group_with_members
.
id
}
/members"
,
guest
),
user_id:
new_user
.
id
,
access_level:
GroupMember
::
MASTER
end
.
not_to
change
{
group_with_members
.
members
.
count
}
expect
(
response
.
status
).
to
eq
(
403
)
end
...
...
@@ -178,9 +176,9 @@ describe API::API, api: true do
context
"when a member of the 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
)
}
.
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
)
end
...
...
spec/requests/api/merge_requests_spec.rb
View file @
15a05be7
...
...
@@ -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_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"
)
}
before
{
before
do
project
.
team
<<
[
user
,
:reporters
]
}
end
describe
"GET /projects/:id/merge_requests"
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
describe
"POST /projects/:id/hooks"
do
it
"should add hook to project"
do
expect
{
post
api
(
"/projects/
#{
project
.
id
}
/hooks"
,
user
),
url:
"http://example.com"
,
issues_events:
true
}.
to
change
{
project
.
hooks
.
count
}.
by
(
1
)
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/hooks"
,
user
),
url:
"http://example.com"
,
issues_events:
true
end
.
to
change
{
project
.
hooks
.
count
}.
by
(
1
)
expect
(
response
.
status
).
to
eq
(
201
)
end
...
...
@@ -105,9 +104,9 @@ describe API::API, 'ProjectHooks', api: true do
describe
"DELETE /projects/:id/hooks/:hook_id"
do
it
"should delete hook from project"
do
expect
{
expect
do
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
)
end
...
...
spec/requests/api/project_members_spec.rb
View file @
15a05be7
...
...
@@ -53,10 +53,9 @@ describe API::API, api: true do
describe
"POST /projects/:id/members"
do
it
"should add user to project team"
do
expect
{
post
api
(
"/projects/
#{
project
.
id
}
/members"
,
user
),
user_id:
user2
.
id
,
access_level:
ProjectMember
::
DEVELOPER
}.
to
change
{
ProjectMember
.
count
}.
by
(
1
)
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/members"
,
user
),
user_id:
user2
.
id
,
access_level:
ProjectMember
::
DEVELOPER
end
.
to
change
{
ProjectMember
.
count
}.
by
(
1
)
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
json_response
[
'username'
]).
to
eq
(
user2
.
username
)
...
...
@@ -66,10 +65,9 @@ describe API::API, api: true 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
,
access_level:
ProjectMember
::
DEVELOPER
expect
{
post
api
(
"/projects/
#{
project
.
id
}
/members"
,
user
),
user_id:
user2
.
id
,
access_level:
ProjectMember
::
DEVELOPER
}.
not_to
change
{
ProjectMember
.
count
}
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/members"
,
user
),
user_id:
user2
.
id
,
access_level:
ProjectMember
::
DEVELOPER
end
.
not_to
change
{
ProjectMember
.
count
}
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
json_response
[
'username'
]).
to
eq
(
user2
.
username
)
...
...
@@ -123,16 +121,16 @@ describe API::API, api: true do
before
{
project_member2
}
it
"should remove user from project team"
do
expect
{
expect
do
delete
api
(
"/projects/
#{
project
.
id
}
/members/
#{
user3
.
id
}
"
,
user
)
}
.
to
change
{
ProjectMember
.
count
}.
by
(
-
1
)
end
.
to
change
{
ProjectMember
.
count
}.
by
(
-
1
)
end
it
"should return 200 if team member is not part of a project"
do
delete
api
(
"/projects/
#{
project
.
id
}
/members/
#{
user3
.
id
}
"
,
user
)
expect
{
expect
do
delete
api
(
"/projects/
#{
project
.
id
}
/members/
#{
user3
.
id
}
"
,
user
)
}
.
to_not
change
{
ProjectMember
.
count
}
end
.
to_not
change
{
ProjectMember
.
count
}
end
it
"should return 200 if team member already removed"
do
...
...
@@ -142,9 +140,9 @@ describe API::API, api: true do
end
it
"should return 200 OK when the user was not member"
do
expect
{
expect
do
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
(
json_response
[
'message'
]).
to
eq
(
"Access revoked"
)
expect
(
json_response
[
'id'
]).
to
eq
(
1000000
)
...
...
spec/services/archive_repository_service_spec.rb
View file @
15a05be7
...
...
@@ -17,9 +17,7 @@ describe ArchiveRepositoryService do
end
it
"raises an error"
do
expect
{
subject
.
execute
(
timeout:
0.0
)
}.
to
raise_error
expect
{
subject
.
execute
(
timeout:
0.0
)
}.
to
raise_error
end
end
...
...
spec/services/git_push_service_spec.rb
View file @
15a05be7
...
...
@@ -218,18 +218,18 @@ describe GitPushService do
end
it
"doesn't create cross-reference notes for a closing reference"
do
expect
{
expect
do
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
it
"doesn't close issues when pushed to non-default branches"
do
project
.
stub
(
default_branch:
'durf'
)
# The push still shouldn't create cross-reference notes.
expect
{
expect
do
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
end
...
...
@@ -238,9 +238,9 @@ describe GitPushService do
allow
(
project
).
to
receive
(
:default_issues_tracker?
).
and_return
(
false
)
# The push still shouldn't create cross-reference notes.
expect
{
expect
do
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
...
...
spec/services/issues/bulk_update_service_spec.rb
View file @
15a05be7
require
'spec_helper'
describe
Issues
::
BulkUpdateService
do
let
(
:issue
)
{
create
(
:issue
,
project:
@project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
@project
)
}
before
do
@user
=
create
:user
...
...
@@ -26,14 +24,14 @@ describe Issues::BulkUpdateService do
}
end
it
{
it
do
result
=
Issues
::
BulkUpdateService
.
new
(
@project
,
@user
,
@params
).
execute
expect
(
result
[
:success
]).
to
be_truthy
expect
(
result
[
:count
]).
to
eq
(
@issues
.
count
)
expect
(
@project
.
issues
.
opened
).
to
be_empty
expect
(
@project
.
issues
.
closed
).
not_to
be_empty
}
end
end
...
...
@@ -49,14 +47,14 @@ describe Issues::BulkUpdateService do
}
end
it
{
it
do
result
=
Issues
::
BulkUpdateService
.
new
(
@project
,
@user
,
@params
).
execute
expect
(
result
[
:success
]).
to
be_truthy
expect
(
result
[
:count
]).
to
eq
(
@issues
.
count
)
expect
(
@project
.
issues
.
closed
).
to
be_empty
expect
(
@project
.
issues
.
opened
).
not_to
be_empty
}
end
end
...
...
@@ -70,13 +68,13 @@ describe Issues::BulkUpdateService do
}
end
it
{
it
do
result
=
Issues
::
BulkUpdateService
.
new
(
@project
,
@user
,
@params
).
execute
expect
(
result
[
:success
]).
to
be_truthy
expect
(
result
[
:count
]).
to
eq
(
1
)
expect
(
@project
.
issues
.
first
.
assignee
).
to
eq
(
@new_assignee
)
}
end
it
'allows mass-unassigning'
do
@project
.
issues
.
first
.
update_attribute
(
:assignee
,
@new_assignee
)
...
...
@@ -109,13 +107,13 @@ describe Issues::BulkUpdateService do
}
end
it
{
it
do
result
=
Issues
::
BulkUpdateService
.
new
(
@project
,
@user
,
@params
).
execute
expect
(
result
[
:success
]).
to
be_truthy
expect
(
result
[
:count
]).
to
eq
(
1
)
expect
(
@project
.
issues
.
first
.
milestone
).
to
eq
(
@milestone
)
}
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