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
7fb2d94e
Commit
7fb2d94e
authored
Mar 07, 2017
by
Z.J. van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Namespace can have only one chat team
parent
df55d35f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
0 deletions
+15
-0
app/models/chat_team.rb
app/models/chat_team.rb
+1
-0
spec/factories/chat_teams.rb
spec/factories/chat_teams.rb
+9
-0
spec/models/chat_team_spec.rb
spec/models/chat_team_spec.rb
+5
-0
No files found.
app/models/chat_team.rb
View file @
7fb2d94e
class
ChatTeam
<
ActiveRecord
::
Base
validates
:team_id
,
presence:
true
validates
:namespace
,
uniqueness:
true
belongs_to
:namespace
end
spec/factories/chat_teams.rb
0 → 100644
View file @
7fb2d94e
FactoryGirl
.
define
do
factory
:chat_team
,
class:
ChatTeam
do
sequence
:team_id
do
|
n
|
"abcdefghijklm
#{
n
}
"
end
namespace
factory: :group
end
end
spec/models/chat_team_spec.rb
View file @
7fb2d94e
require
'spec_helper'
describe
ChatTeam
,
type: :model
do
subject
{
create
(
:chat_team
)
}
# Associations
it
{
is_expected
.
to
belong_to
(
:namespace
)
}
# Validations
it
{
is_expected
.
to
validate_uniqueness_of
(
:namespace
)
}
# Fields
it
{
is_expected
.
to
respond_to
(
:name
)
}
it
{
is_expected
.
to
respond_to
(
:team_id
)
}
...
...
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