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
Boxiang Sun
gitlab-ce
Commits
d683ce5c
Commit
d683ce5c
authored
Oct 02, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored factory + fixed tests
parent
fa3ae24c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
21 deletions
+8
-21
spec/factories.rb
spec/factories.rb
+6
-0
spec/factories/groups.rb
spec/factories/groups.rb
+0
-21
spec/models/group_spec.rb
spec/models/group_spec.rb
+2
-0
No files found.
spec/factories.rb
View file @
d683ce5c
...
@@ -47,6 +47,12 @@ FactoryGirl.define do
...
@@ -47,6 +47,12 @@ FactoryGirl.define do
owner
owner
end
end
factory
:group
do
sequence
(
:name
)
{
|
n
|
"group
#{
n
}
"
}
code
{
name
.
downcase
.
gsub
(
/\s/
,
'_'
)
}
owner
end
factory
:users_project
do
factory
:users_project
do
user
user
project
project
...
...
spec/factories/groups.rb
deleted
100644 → 0
View file @
fa3ae24c
# == Schema Information
#
# Table name: groups
#
# id :integer not null, primary key
# name :string(255) not null
# code :string(255) not null
# owner_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl
.
define
do
factory
:group
do
name
"MyString"
code
"MyString"
owner_id
1
end
end
spec/models/group_spec.rb
View file @
d683ce5c
...
@@ -13,6 +13,8 @@
...
@@ -13,6 +13,8 @@
require
'spec_helper'
require
'spec_helper'
describe
Group
do
describe
Group
do
let!
(
:group
)
{
create
(
:group
)
}
it
{
should
have_many
:projects
}
it
{
should
have_many
:projects
}
it
{
should
validate_presence_of
:name
}
it
{
should
validate_presence_of
:name
}
it
{
should
validate_uniqueness_of
(
:name
)
}
it
{
should
validate_uniqueness_of
(
:name
)
}
...
...
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