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
Léo-Paul Géneau
gitlab-ce
Commits
13f017f0
Commit
13f017f0
authored
Jun 30, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix user model specs
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
8daa69a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
47 deletions
+11
-47
spec/models/user_spec.rb
spec/models/user_spec.rb
+11
-47
No files found.
spec/models/user_spec.rb
View file @
13f017f0
...
...
@@ -241,59 +241,23 @@ describe User do
it
{
user
.
first_name
.
should
==
'John'
}
end
describe
'with
out
defaults'
do
describe
'with defaults'
do
let
(
:user
)
{
User
.
new
}
it
"should not apply defaults to user"
do
user
.
projects_limit
.
should
==
10
user
.
can_create_group
.
should
be_true
user
.
theme_id
.
should
==
Gitlab
::
Theme
::
BASIC
end
end
context
'as admin'
do
describe
'with defaults'
do
let
(
:user
)
{
User
.
build_user
({},
as: :admin
)
}
it
"should apply defaults to user"
do
user
.
projects_limit
.
should
==
Gitlab
.
config
.
gitlab
.
default_projects_limit
user
.
can_create_group
.
should
==
Gitlab
.
config
.
gitlab
.
default_can_create_group
user
.
theme_id
.
should
==
Gitlab
.
config
.
gitlab
.
default_theme
end
end
describe
'with default overrides'
do
let
(
:user
)
{
User
.
build_user
({
projects_limit:
123
,
can_create_group:
true
,
can_create_team:
true
,
theme_id:
Gitlab
::
Theme
::
BASIC
},
as: :admin
)
}
it
"should apply defaults to user"
do
Gitlab
.
config
.
gitlab
.
default_projects_limit
.
should_not
==
123
Gitlab
.
config
.
gitlab
.
default_can_create_group
.
should_not
be_true
Gitlab
.
config
.
gitlab
.
default_theme
.
should_not
==
Gitlab
::
Theme
::
BASIC
user
.
projects_limit
.
should
==
123
user
.
can_create_group
.
should
be_true
user
.
theme_id
.
should
==
Gitlab
::
Theme
::
BASIC
end
it
"should apply defaults to user"
do
user
.
projects_limit
.
should
==
Gitlab
.
config
.
gitlab
.
default_projects_limit
user
.
can_create_group
.
should
==
Gitlab
.
config
.
gitlab
.
default_can_create_group
user
.
theme_id
.
should
==
Gitlab
.
config
.
gitlab
.
default_theme
end
end
context
'as user'
do
describe
'with defaults'
do
let
(
:user
)
{
User
.
build_user
}
describe
'with default overrides'
do
let
(
:user
)
{
User
.
new
(
projects_limit:
123
,
can_create_group:
false
,
can_create_team:
true
,
theme_id:
Gitlab
::
Theme
::
BASIC
)
}
it
"should apply defaults to user"
do
user
.
projects_limit
.
should
==
Gitlab
.
config
.
gitlab
.
default_projects_limit
user
.
can_create_group
.
should
==
Gitlab
.
config
.
gitlab
.
default_can_create_group
user
.
theme_id
.
should
==
Gitlab
.
config
.
gitlab
.
default_theme
end
end
describe
'with default overrides'
do
let
(
:user
)
{
User
.
build_user
(
projects_limit:
123
,
can_create_group:
true
,
theme_id:
Gitlab
::
Theme
::
BASIC
)
}
it
"should apply defaults to user"
do
user
.
projects_limit
.
should
==
Gitlab
.
config
.
gitlab
.
default_projects_limit
user
.
can_create_group
.
should
==
Gitlab
.
config
.
gitlab
.
default_can_create_group
user
.
theme_id
.
should
==
Gitlab
.
config
.
gitlab
.
default_theme
end
it
"should apply defaults to user"
do
user
.
projects_limit
.
should
==
123
user
.
can_create_group
.
should
be_false
user
.
theme_id
.
should
==
Gitlab
::
Theme
::
BASIC
end
end
end
...
...
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