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
iv
gitlab-ce
Commits
e0e88cdd
Commit
e0e88cdd
authored
Sep 14, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests
parent
90dc5ff5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
8 deletions
+14
-8
spec/models/user_spec.rb
spec/models/user_spec.rb
+13
-7
spec/requests/api/users_spec.rb
spec/requests/api/users_spec.rb
+1
-1
No files found.
spec/models/user_spec.rb
View file @
e0e88cdd
...
@@ -209,6 +209,7 @@ describe User do
...
@@ -209,6 +209,7 @@ describe User do
describe
'without defaults'
do
describe
'without defaults'
do
let
(
:user
)
{
User
.
new
}
let
(
:user
)
{
User
.
new
}
it
"should not apply defaults to user"
do
it
"should not apply defaults to user"
do
user
.
projects_limit
.
should
==
10
user
.
projects_limit
.
should
==
10
user
.
can_create_group
.
should
be_true
user
.
can_create_group
.
should
be_true
...
@@ -218,19 +219,21 @@ describe User do
...
@@ -218,19 +219,21 @@ describe User do
context
'as admin'
do
context
'as admin'
do
describe
'with defaults'
do
describe
'with defaults'
do
let
(
:user
)
{
User
.
build_user
({},
as: :admin
)
}
let
(
:user
)
{
User
.
build_user
({},
as: :admin
)
}
it
"should apply defaults to user"
do
it
"should apply defaults to user"
do
user
.
projects_limit
.
should
==
42
user
.
projects_limit
.
should
==
42
user
.
can_create_group
.
should
be_false
user
.
can_create_group
.
should
be_false
user
.
theme_id
.
should
==
Gitlab
::
Theme
::
BASIC
user
.
theme_id
.
should
==
Gitlab
::
Theme
::
MARS
end
end
end
end
describe
'with default overrides'
do
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
::
MARS
},
as: :admin
)
}
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
it
"should apply defaults to user"
do
user
.
projects_limit
.
should
==
123
user
.
projects_limit
.
should
==
123
user
.
can_create_group
.
should
be_true
user
.
can_create_group
.
should
be_true
user
.
theme_id
.
should
==
Gitlab
::
Theme
::
MARS
user
.
theme_id
.
should
==
Gitlab
::
Theme
::
BASIC
end
end
end
end
end
end
...
@@ -238,26 +241,29 @@ describe User do
...
@@ -238,26 +241,29 @@ describe User do
context
'as user'
do
context
'as user'
do
describe
'with defaults'
do
describe
'with defaults'
do
let
(
:user
)
{
User
.
build_user
}
let
(
:user
)
{
User
.
build_user
}
it
"should apply defaults to user"
do
it
"should apply defaults to user"
do
user
.
projects_limit
.
should
==
42
user
.
projects_limit
.
should
==
42
user
.
can_create_group
.
should
be_false
user
.
can_create_group
.
should
be_false
user
.
theme_id
.
should
==
Gitlab
::
Theme
::
BASIC
user
.
theme_id
.
should
==
Gitlab
::
Theme
::
MARS
end
end
end
end
describe
'with default overrides'
do
describe
'with default overrides'
do
let
(
:user
)
{
User
.
build_user
(
projects_limit:
123
,
can_create_group:
true
,
theme_id:
Gitlab
::
Theme
::
MARS
)
}
let
(
:user
)
{
User
.
build_user
(
projects_limit:
123
,
can_create_group:
true
,
theme_id:
Gitlab
::
Theme
::
BASIC
)
}
it
"should apply defaults to user"
do
it
"should apply defaults to user"
do
user
.
projects_limit
.
should
==
42
user
.
projects_limit
.
should
==
42
user
.
can_create_group
.
should
be_false
user
.
can_create_group
.
should
be_false
user
.
theme_id
.
should
==
Gitlab
::
Theme
::
BASIC
user
.
theme_id
.
should
==
Gitlab
::
Theme
::
MARS
end
end
end
end
end
end
end
end
describe
'by_username_or_id'
do
describe
'by_username_or_id'
do
let
(
:user1
){
create
(
:user
,
username:
'foo'
)}
let
(
:user1
)
{
create
(
:user
,
username:
'foo'
)
}
it
"should get the correct user"
do
it
"should get the correct user"
do
User
.
by_username_or_id
(
user1
.
id
).
should
==
user1
User
.
by_username_or_id
(
user1
.
id
).
should
==
user1
User
.
by_username_or_id
(
'foo'
).
should
==
user1
User
.
by_username_or_id
(
'foo'
).
should
==
user1
...
...
spec/requests/api/users_spec.rb
View file @
e0e88cdd
...
@@ -66,7 +66,7 @@ describe API::API do
...
@@ -66,7 +66,7 @@ describe API::API do
}.
to
change
{
User
.
count
}.
by
(
1
)
}.
to
change
{
User
.
count
}.
by
(
1
)
user
=
User
.
find_by_username
(
attr
[
:username
])
user
=
User
.
find_by_username
(
attr
[
:username
])
user
.
projects_limit
.
should
==
limit
user
.
projects_limit
.
should
==
limit
user
.
theme_id
.
should
==
Gitlab
::
Theme
::
BASIC
user
.
theme_id
.
should
==
Gitlab
::
Theme
::
MARS
Gitlab
.
config
.
gitlab
.
unstub
(
:default_projects_limit
)
Gitlab
.
config
.
gitlab
.
unstub
(
:default_projects_limit
)
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