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
Jérome Perrin
gitlab-ce
Commits
65601ade
Commit
65601ade
authored
Dec 30, 2011
by
miks
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Specs for deploy_keys
parent
b85ae028
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
5 deletions
+83
-5
spec/factories.rb
spec/factories.rb
+5
-0
spec/models/deploy_key_spec.rb
spec/models/deploy_key_spec.rb
+1
-5
spec/requests/projects_deploy_keys_spec.rb
spec/requests/projects_deploy_keys_spec.rb
+68
-0
spec/requests/projects_security_spec.rb
spec/requests/projects_security_spec.rb
+9
-0
No files found.
spec/factories.rb
View file @
65601ade
...
@@ -56,6 +56,11 @@ Factory.add(:key, Key) do |obj|
...
@@ -56,6 +56,11 @@ Factory.add(:key, Key) do |obj|
obj
.
key
=
File
.
read
(
File
.
join
(
Rails
.
root
,
"db"
,
"pkey.example"
))
obj
.
key
=
File
.
read
(
File
.
join
(
Rails
.
root
,
"db"
,
"pkey.example"
))
end
end
Factory
.
add
(
:deploy_key
,
DeployKey
)
do
|
obj
|
obj
.
title
=
"Example key"
obj
.
key
=
File
.
read
(
File
.
join
(
Rails
.
root
,
"db"
,
"pkey.example"
))
end
Factory
.
add
(
:web_hook
,
WebHook
)
do
|
obj
|
Factory
.
add
(
:web_hook
,
WebHook
)
do
|
obj
|
obj
.
url
=
Faker
::
Internet
.
url
obj
.
url
=
Faker
::
Internet
.
url
end
end
spec/models/deploy_key_spec.rb
View file @
65601ade
...
@@ -10,11 +10,7 @@ describe DeployKey do
...
@@ -10,11 +10,7 @@ describe DeployKey do
it
{
should
validate_presence_of
(
:key
)
}
it
{
should
validate_presence_of
(
:key
)
}
end
end
describe
"Methods"
do
it
{
Factory
.
create
(
:deploy_key
,
it
{
should
respond_to
:projects
}
end
it
{
Factory
.
create
(
:key
,
:project
=>
Factory
(
:project
)).
should
be_valid
}
:project
=>
Factory
(
:project
)).
should
be_valid
}
end
end
# == Schema Information
# == Schema Information
...
...
spec/requests/projects_deploy_keys_spec.rb
0 → 100644
View file @
65601ade
require
'spec_helper'
describe
"DeployKeys"
do
let
(
:project
)
{
Factory
:project
}
before
do
login_as
:user
project
.
add_access
(
@user
,
:read
,
:write
,
:admin
)
end
describe
"GET /keys"
do
before
do
@key
=
Factory
:deploy_key
,
:project
=>
project
visit
project_deploy_keys_path
(
project
)
end
subject
{
page
}
it
{
should
have_content
(
@key
.
title
)
}
describe
"Destroy"
do
before
{
visit
project_deploy_key_path
(
project
,
@key
)
}
it
"should remove entry"
do
expect
{
click_link
"Remove"
}.
to
change
{
project
.
deploy_keys
.
count
}.
by
(
-
1
)
end
end
end
describe
"New key"
,
:js
=>
true
do
before
do
visit
project_deploy_keys_path
(
project
)
click_link
"Add new"
end
it
"should open new key popup"
do
page
.
should
have_content
(
"Add new public key"
)
end
describe
"fill in"
do
before
do
fill_in
"deploy_key_title"
,
:with
=>
"laptop"
fill_in
"deploy_key_key"
,
:with
=>
"publickey234="
end
it
{
expect
{
click_button
"Save"
}.
to
change
{
Key
.
count
}.
by
(
1
)
}
it
"should add new key to table"
do
click_button
"Save"
page
.
should_not
have_content
(
"Add new public key"
)
page
.
should
have_content
"laptop"
end
end
end
describe
"Show page"
do
before
do
@key
=
Factory
:deploy_key
,
:project
=>
project
visit
project_deploy_key_path
(
project
,
@key
)
end
it
{
page
.
should
have_content
@key
.
title
}
it
{
page
.
should
have_content
@key
.
key
[
0
..
10
]
}
end
end
spec/requests/projects_security_spec.rb
View file @
65601ade
...
@@ -105,6 +105,15 @@ describe "Projects" do
...
@@ -105,6 +105,15 @@ describe "Projects" do
it
{
edit_project_path
(
@project
).
should
be_denied_for
:visitor
}
it
{
edit_project_path
(
@project
).
should
be_denied_for
:visitor
}
end
end
describe
"GET /project_code/deploy_keys"
do
it
{
project_deploy_keys_path
(
@project
).
should
be_allowed_for
@u1
}
it
{
project_deploy_keys_path
(
@project
).
should
be_denied_for
@u3
}
it
{
project_deploy_keys_path
(
@project
).
should
be_denied_for
:admin
}
it
{
project_deploy_keys_path
(
@project
).
should
be_denied_for
@u2
}
it
{
project_deploy_keys_path
(
@project
).
should
be_denied_for
:user
}
it
{
project_deploy_keys_path
(
@project
).
should
be_denied_for
:visitor
}
end
describe
"GET /project_code/issues"
do
describe
"GET /project_code/issues"
do
it
{
project_issues_path
(
@project
).
should
be_allowed_for
@u1
}
it
{
project_issues_path
(
@project
).
should
be_allowed_for
@u1
}
it
{
project_issues_path
(
@project
).
should
be_allowed_for
@u3
}
it
{
project_issues_path
(
@project
).
should
be_allowed_for
@u3
}
...
...
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