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
8549d709
Commit
8549d709
authored
Sep 15, 2015
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix ci/projects_controller_spec.rb
parent
269b9224
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
27 deletions
+9
-27
spec/controllers/ci/projects_controller_spec.rb
spec/controllers/ci/projects_controller_spec.rb
+9
-27
No files found.
spec/controllers/ci/projects_controller_spec.rb
View file @
8549d709
...
@@ -49,24 +49,17 @@ describe Ci::ProjectsController do
...
@@ -49,24 +49,17 @@ describe Ci::ProjectsController do
end
end
describe
"POST /projects"
do
describe
"POST /projects"
do
let
(
:project_dump
)
{
YAML
.
load
File
.
read
(
Rails
.
root
.
join
(
'spec/support/gitlab_stubs/raw_project.yml'
))
}
let
(
:project_dump
)
{
OpenStruct
.
new
({
id:
@project
.
gitlab_id
})
}
let
(
:gitlab_url
)
{
GitlabCi
.
config
.
gitlab_server
.
url
}
let
(
:user_data
)
do
data
=
JSON
.
parse
File
.
read
(
Rails
.
root
.
join
(
'spec/support/gitlab_stubs/user.json'
))
data
.
merge
(
"url"
=>
gitlab_url
)
end
let
(
:user
)
do
let
(
:user
)
do
create
(
:user
)
create
(
:user
)
end
end
it
"creates project"
do
before
do
allow
(
controller
).
to
receive
(
:reset_cache
)
{
true
}
sign_in
(
user
)
allow
(
controller
).
to
receive
(
:current_user
)
{
user
}
end
allow_any_instance_of
(
Ci
::
Network
).
to
receive
(
:enable_ci
).
and_return
(
true
)
allow_any_instance_of
(
Ci
::
Network
).
to
receive
(
:project_hooks
).
and_return
(
true
)
it
"creates project"
do
post
:create
,
{
project:
JSON
.
dump
(
project_dump
.
to_h
)
}.
with_indifferent_access
post
:create
,
{
project:
JSON
.
dump
(
project_dump
.
to_h
)
}.
with_indifferent_access
expect
(
response
.
code
).
to
eq
(
'302'
)
expect
(
response
.
code
).
to
eq
(
'302'
)
...
@@ -74,10 +67,6 @@ describe Ci::ProjectsController do
...
@@ -74,10 +67,6 @@ describe Ci::ProjectsController do
end
end
it
"shows error"
do
it
"shows error"
do
allow
(
controller
).
to
receive
(
:reset_cache
)
{
true
}
allow
(
controller
).
to
receive
(
:current_user
)
{
user
}
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
post
:create
,
{
project:
JSON
.
dump
(
project_dump
.
to_h
)
}.
with_indifferent_access
expect
(
response
.
code
).
to
eq
(
'302'
)
expect
(
response
.
code
).
to
eq
(
'302'
)
...
@@ -86,22 +75,15 @@ describe Ci::ProjectsController do
...
@@ -86,22 +75,15 @@ describe Ci::ProjectsController do
end
end
describe
"GET /gitlab"
do
describe
"GET /gitlab"
do
let
(
:gitlab_url
)
{
GitlabCi
.
config
.
gitlab_server
.
url
}
let
(
:user_data
)
do
data
=
JSON
.
parse
File
.
read
(
Rails
.
root
.
join
(
'spec/support/gitlab_stubs/user.json'
))
data
.
merge
(
"url"
=>
gitlab_url
)
end
let
(
:user
)
do
let
(
:user
)
do
create
(
:user
)
create
(
:user
)
end
end
it
"searches projects"
do
before
do
allow
(
controller
).
to
receive
(
:reset_cache
)
{
true
}
sign_in
(
user
)
allow
(
controller
).
to
receive
(
:current_user
)
{
user
}
end
allow_any_instance_of
(
Ci
::
Network
).
to
receive
(
:projects
).
with
(
hash_including
(
search:
'str'
),
:authorized
)
it
"searches projects"
do
xhr
:get
,
:gitlab
,
{
search:
"str"
,
format:
"js"
}.
with_indifferent_access
xhr
:get
,
:gitlab
,
{
search:
"str"
,
format:
"js"
}.
with_indifferent_access
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
...
...
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