BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
42b86b79
Commit
42b86b79
authored
May 06, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Model specs for DeployKeys
parent
ff346c01
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
20 deletions
+44
-20
factories.rb
spec/factories.rb
+6
-2
deploy_key_spec.rb
spec/models/deploy_key_spec.rb
+25
-0
deploy_keys_project_spec.rb
spec/models/deploy_keys_project_spec.rb
+13
-0
key_spec.rb
spec/models/key_spec.rb
+0
-18
No files found.
spec/factories.rb
View file @
42b86b79
...
...
@@ -158,8 +158,7 @@ FactoryGirl.define do
"ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0="
end
factory
:deploy_key
do
project
factory
:deploy_key
,
class:
'DeployKey'
do
end
factory
:personal_key
do
...
...
@@ -222,4 +221,9 @@ FactoryGirl.define do
url
service
end
factory
:deploy_keys_project
do
deploy_key
project
end
end
spec/models/deploy_key_spec.rb
0 → 100644
View file @
42b86b79
# == Schema Information
#
# Table name: keys
#
# id :integer not null, primary key
# user_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# key :text
# title :string(255)
# identifier :string(255)
# project_id :integer
#
require
'spec_helper'
describe
DeployKey
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:deploy_key
)
{
create
(
:deploy_key
,
projects:
[
project
])
}
describe
"Associations"
do
it
{
should
have_many
(
:deploy_keys_projects
)
}
it
{
should
have_many
(
:projects
)
}
end
end
spec/models/deploy_keys_project_spec.rb
0 → 100644
View file @
42b86b79
require
'spec_helper'
describe
DeployKeysProject
do
describe
"Associations"
do
it
{
should
belong_to
(
:deploy_key
)
}
it
{
should
belong_to
(
:project
)
}
end
describe
"Validation"
do
it
{
should
validate_presence_of
(
:project_id
)
}
it
{
should
validate_presence_of
(
:deploy_key_id
)
}
end
end
spec/models/key_spec.rb
View file @
42b86b79
...
...
@@ -17,7 +17,6 @@ require 'spec_helper'
describe
Key
do
describe
"Associations"
do
it
{
should
belong_to
(
:user
)
}
it
{
should
belong_to
(
:project
)
}
end
describe
"Mass assignment"
do
...
...
@@ -37,22 +36,6 @@ describe Key do
end
context
"validation of uniqueness"
do
context
"as a deploy key"
do
let!
(
:deploy_key
)
{
create
(
:deploy_key
)
}
it
"does not accept the same key twice for a project"
do
key
=
build
(
:key
,
project:
deploy_key
.
project
)
key
.
should_not
be_valid
end
it
"does not accept the same key for another project"
do
key
=
build
(
:key
,
project_id:
0
)
key
.
should_not
be_valid
end
end
context
"as a personal key"
do
let
(
:user
)
{
create
(
:user
)
}
it
"accepts the key once"
do
...
...
@@ -64,7 +47,6 @@ describe Key do
build
(
:key
,
user:
user
).
should_not
be_valid
end
end
end
context
"validate it is a fingerprintable key"
do
let
(
:user
)
{
create
(
:user
)
}
...
...
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