Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
9a9417ee
Commit
9a9417ee
authored
Sep 10, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix more tests
parent
dc2e38e5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
66 deletions
+16
-66
spec/controllers/ci/projects_controller_spec.rb
spec/controllers/ci/projects_controller_spec.rb
+3
-3
spec/models/ci/project_services/hip_chat_message_spec.rb
spec/models/ci/project_services/hip_chat_message_spec.rb
+4
-4
spec/models/ci/project_services/hip_chat_service_spec.rb
spec/models/ci/project_services/hip_chat_service_spec.rb
+4
-4
spec/models/ci/project_services/slack_message_spec.rb
spec/models/ci/project_services/slack_message_spec.rb
+2
-2
spec/models/ci/project_services/slack_service_spec.rb
spec/models/ci/project_services/slack_service_spec.rb
+3
-3
spec/models/ci/user_spec.rb
spec/models/ci/user_spec.rb
+0
-50
No files found.
spec/controllers/ci/projects_controller_spec.rb
View file @
9a9417ee
...
...
@@ -55,7 +55,7 @@ describe Ci::ProjectsController do
end
let
(
:user
)
do
Ci
::
User
.
new
(
user_data
)
create
(
:user
)
end
it
"creates project"
do
...
...
@@ -73,7 +73,7 @@ describe Ci::ProjectsController do
it
"shows error"
do
allow
(
controller
).
to
receive
(
:reset_cache
)
{
true
}
allow
(
controller
).
to
receive
(
:current_user
)
{
user
}
allow_any_instance_of
(
Ci
::
User
).
to
receive
(
:can_manage_project?
).
and_return
(
false
)
allow_any_instance_of
(
User
).
to
receive
(
:can_manage_project?
).
and_return
(
false
)
post
:create
,
{
project:
JSON
.
dump
(
project_dump
.
to_h
)
}.
with_indifferent_access
...
...
@@ -91,7 +91,7 @@ describe Ci::ProjectsController do
end
let
(
:user
)
do
Ci
::
User
.
new
(
user_data
)
create
(
:user
)
end
it
"searches projects"
do
...
...
spec/models/ci/project_services/hip_chat_message_spec.rb
View file @
9a9417ee
require
'spec_helper'
describe
Ci
::
HipChatMessage
do
subject
{
HipChatMessage
.
new
(
build
)
}
subject
{
Ci
::
HipChatMessage
.
new
(
build
)
}
let
(
:project
)
{
FactoryGirl
.
create
(
:project
)
}
let
(
:project
)
{
FactoryGirl
.
create
(
:
ci_
project
)
}
context
"One build"
do
let
(
:commit
)
{
FactoryGirl
.
create
(
:commit_with_one_job
,
project:
project
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:c
i_c
ommit_with_one_job
,
project:
project
)
}
let
(
:build
)
do
commit
.
create_builds
...
...
@@ -37,7 +37,7 @@ describe Ci::HipChatMessage do
end
context
"Several builds"
do
let
(
:commit
)
{
FactoryGirl
.
create
(
:commit_with_two_jobs
,
project:
project
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:c
i_c
ommit_with_two_jobs
,
project:
project
)
}
let
(
:build
)
do
commit
.
builds
.
first
...
...
spec/models/ci/project_services/hip_chat_service_spec.rb
View file @
9a9417ee
...
...
@@ -32,10 +32,10 @@ describe Ci::HipChatService do
describe
"Execute"
do
let
(
:service
)
{
HipChatService
.
new
}
let
(
:project
)
{
FactoryGirl
.
create
:project
}
let
(
:commit
)
{
FactoryGirl
.
create
:commit
,
project:
project
}
let
(
:build
)
{
FactoryGirl
.
create
:build
,
commit:
commit
,
status:
'failed'
}
let
(
:service
)
{
Ci
::
HipChatService
.
new
}
let
(
:project
)
{
FactoryGirl
.
create
:
ci_
project
}
let
(
:commit
)
{
FactoryGirl
.
create
:c
i_c
ommit
,
project:
project
}
let
(
:build
)
{
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
,
status:
'failed'
}
let
(
:api_url
)
{
'https://api.hipchat.com/v2/room/123/notification?auth_token=a1b2c3d4e5f6'
}
before
do
...
...
spec/models/ci/project_services/slack_message_spec.rb
View file @
9a9417ee
...
...
@@ -3,10 +3,10 @@ require 'spec_helper'
describe
Ci
::
SlackMessage
do
subject
{
SlackMessage
.
new
(
commit
)
}
let
(
:project
)
{
FactoryGirl
.
create
:project
}
let
(
:project
)
{
FactoryGirl
.
create
:
ci_
project
}
context
"One build"
do
let
(
:commit
)
{
FactoryGirl
.
create
(
:commit_with_one_job
,
project:
project
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:c
i_c
ommit_with_one_job
,
project:
project
)
}
let
(
:build
)
do
commit
.
create_builds
...
...
spec/models/ci/project_services/slack_service_spec.rb
View file @
9a9417ee
...
...
@@ -31,9 +31,9 @@ describe Ci::SlackService do
describe
"Execute"
do
let
(
:slack
)
{
SlackService
.
new
}
let
(
:project
)
{
FactoryGirl
.
create
:project
}
let
(
:commit
)
{
FactoryGirl
.
create
:commit
,
project:
project
}
let
(
:build
)
{
FactoryGirl
.
create
:build
,
commit:
commit
,
status:
'failed'
}
let
(
:project
)
{
FactoryGirl
.
create
:
ci_
project
}
let
(
:commit
)
{
FactoryGirl
.
create
:c
i_c
ommit
,
project:
project
}
let
(
:build
)
{
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
,
status:
'failed'
}
let
(
:webhook_url
)
{
'https://hooks.slack.com/services/SVRWFV0VVAR97N/B02R25XN3/ZBqu7xMupaEEICInN685'
}
let
(
:notify_only_broken_builds
)
{
false
}
...
...
spec/models/ci/user_spec.rb
deleted
100644 → 0
View file @
dc2e38e5
require
'spec_helper'
describe
Ci
::
User
do
describe
"authorized_projects"
do
let
(
:user
)
{
User
.
new
({})
}
before
do
FactoryGirl
.
create
:ci_project
,
gitlab_id:
1
FactoryGirl
.
create
:ci_project
,
gitlab_id:
2
gitlab_project
=
OpenStruct
.
new
({
id:
1
})
gitlab_project1
=
OpenStruct
.
new
({
id:
2
})
allow_any_instance_of
(
User
).
to
receive
(
:gitlab_projects
).
and_return
([
gitlab_project
,
gitlab_project1
])
end
it
"returns projects"
do
allow_any_instance_of
(
User
).
to
receive
(
:can_manage_project?
).
and_return
(
true
)
expect
(
user
.
authorized_projects
.
count
).
to
eq
(
2
)
end
it
"empty list if user miss manage permission"
do
allow_any_instance_of
(
User
).
to
receive
(
:can_manage_project?
).
and_return
(
false
)
expect
(
user
.
authorized_projects
.
count
).
to
eq
(
0
)
end
end
describe
"authorized_runners"
do
it
"returns authorized runners"
do
project
=
FactoryGirl
.
create
:ci_project
,
gitlab_id:
1
project1
=
FactoryGirl
.
create
:ci_project
,
gitlab_id:
2
gitlab_project
=
OpenStruct
.
new
({
id:
1
})
gitlab_project1
=
OpenStruct
.
new
({
id:
2
})
allow_any_instance_of
(
User
).
to
receive
(
:gitlab_projects
).
and_return
([
gitlab_project
,
gitlab_project1
])
allow_any_instance_of
(
User
).
to
receive
(
:can_manage_project?
).
and_return
(
true
)
user
=
User
.
new
({})
runner
=
FactoryGirl
.
create
:ci_specific_runner
runner1
=
FactoryGirl
.
create
:ci_specific_runner
runner2
=
FactoryGirl
.
create
:ci_specific_runner
project
.
runners
<<
runner
project1
.
runners
<<
runner1
expect
(
user
.
authorized_runners
).
to
include
(
runner
,
runner1
)
expect
(
user
.
authorized_runners
).
not_to
include
(
runner2
)
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