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
59241299
Commit
59241299
authored
Dec 16, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Account role spec
parent
26afde94
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
12 deletions
+48
-12
spec/models/user_spec.rb
spec/models/user_spec.rb
+4
-12
spec/roles/account_role_spec.rb
spec/roles/account_role_spec.rb
+44
-0
No files found.
spec/models/user_spec.rb
View file @
59241299
...
...
@@ -66,6 +66,10 @@ describe User do
it
{
should
ensure_length_of
(
:bio
).
is_within
(
0
..
255
)
}
end
describe
'modules'
do
it
{
should
include_module
(
Account
)
}
end
describe
"Respond to"
do
it
{
should
respond_to
(
:is_admin?
)
}
it
{
should
respond_to
(
:identifier
)
}
...
...
@@ -115,16 +119,4 @@ describe User do
user
.
authentication_token
.
should_not
be_blank
end
end
describe
'projects and namespaces'
do
before
do
ActiveRecord
::
Base
.
observers
.
enable
(
:user_observer
)
@user
=
create
:user
@project
=
create
:project
,
namespace:
@user
.
namespace
end
it
{
@user
.
authorized_projects
.
should
include
(
@project
)
}
it
{
@user
.
my_own_projects
.
should
include
(
@project
)
}
it
{
@user
.
several_namespaces?
.
should
be_false
}
end
end
spec/roles/account_role_spec.rb
0 → 100644
View file @
59241299
require
'spec_helper'
describe
User
,
"Account"
do
describe
'normal user'
do
let
(
:user
)
{
create
(
:user
,
name:
'John Smith'
)
}
it
{
user
.
is_admin?
.
should
be_false
}
it
{
user
.
require_ssh_key?
.
should
be_true
}
it
{
user
.
can_create_group?
.
should
be_false
}
it
{
user
.
can_create_project?
.
should
be_true
}
it
{
user
.
first_name
.
should
==
'John'
}
end
describe
'blocking user'
do
let
(
:user
)
{
create
(
:user
,
name:
'John Smith'
)
}
it
"should block user"
do
user
.
block
user
.
blocked
.
should
be_true
end
end
describe
'projects'
do
before
do
ActiveRecord
::
Base
.
observers
.
enable
(
:user_observer
)
@user
=
create
:user
@project
=
create
:project
,
namespace:
@user
.
namespace
end
it
{
@user
.
authorized_projects
.
should
include
(
@project
)
}
it
{
@user
.
my_own_projects
.
should
include
(
@project
)
}
end
describe
'namespaced'
do
before
do
ActiveRecord
::
Base
.
observers
.
enable
(
:user_observer
)
@user
=
create
:user
@project
=
create
:project
,
namespace:
@user
.
namespace
end
it
{
@user
.
several_namespaces?
.
should
be_false
}
it
{
@user
.
namespaces
.
should
==
[
@user
.
namespace
]
}
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