Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cleaning-portalmec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Richard Fernando Heise Ferreira
cleaning-portalmec
Commits
db2fb6ca
Commit
db2fb6ca
authored
7 years ago
by
Marcela Ribeiro de Oliveira
Browse files
Options
Downloads
Patches
Plain Diff
rspec tests working
parent
bbccc139
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
spec/acceptance/learning_objects_spec.rb
+4
-4
4 additions, 4 deletions
spec/acceptance/learning_objects_spec.rb
spec/shared/contexts.rb
+65
-0
65 additions, 0 deletions
spec/shared/contexts.rb
with
69 additions
and
4 deletions
spec/acceptance/learning_objects_spec.rb
+
4
−
4
View file @
db2fb6ca
...
...
@@ -41,7 +41,7 @@ resource 'Learning Objects' do
end
post
'/v1/learning_objects'
do
include_context
"authenticate_user"
include_context
"authenticate_user
_submitter
"
parameter
:author
,
'The author of a educational content'
,
scope: :learning_object
parameter
:name
,
'The name of the learning object'
,
scope: :learning_object
...
...
@@ -79,7 +79,7 @@ resource 'Learning Objects' do
end
put
'/v1/learning_objects/:id'
do
include_context
"authenticate_user"
include_context
"authenticate_user
_submitter
"
parameter
:author
,
'The author of a educational content'
parameter
:name
,
'The name of the learning object'
...
...
@@ -159,12 +159,12 @@ resource 'Learning Objects' do
end
post
'/v1/learning_objects/:id/publish'
do
include_context
"authenticate_user"
include_context
"authenticate_user
_moderator
"
let
(
:id
)
{
@learning_object
.
id
}
before
do
@learning_object
=
create
(
:learning_object
,
publisher:
@user
,
state:
LearningObject
.
states
[
:
draft
])
@learning_object
=
create
(
:learning_object
,
publisher:
@user
,
state:
LearningObject
.
states
[
:
submitted
])
end
example
'Publishing a learning object'
do
...
...
This diff is collapsed.
Click to expand it.
spec/shared/contexts.rb
+
65
−
0
View file @
db2fb6ca
...
...
@@ -28,3 +28,68 @@ RSpec.shared_context "authenticate_user_admin", shared_context: :metadata do
end
end
RSpec
.
shared_context
"authenticate_user_submitter"
,
shared_context: :metadata
do
let
(
:auth_client
)
{
@auth_headers
[
'client'
]
}
let
(
:uid
)
{
@auth_headers
[
'uid'
]
}
let
(
:access_token
)
{
@auth_headers
[
'access-token'
]
}
let
(
:role
)
{
Role
.
all
}
before
do
@user
=
create
(
:user
,
roles:
[
role
.
find_by
(
name:
'submitter'
)])
@auth_headers
=
@user
.
create_new_auth_token
end
end
RSpec
.
shared_context
"authenticate_user_curator"
,
shared_context: :metadata
do
let
(
:auth_client
)
{
@auth_headers
[
'client'
]
}
let
(
:uid
)
{
@auth_headers
[
'uid'
]
}
let
(
:access_token
)
{
@auth_headers
[
'access-token'
]
}
let
(
:role
)
{
Role
.
all
}
before
do
@user
=
create
(
:user
,
roles:
[
role
.
find_by
(
name:
'curator'
)])
@auth_headers
=
@user
.
create_new_auth_token
end
end
RSpec
.
shared_context
"authenticate_user_moderator"
,
shared_context: :metadata
do
let
(
:auth_client
)
{
@auth_headers
[
'client'
]
}
let
(
:uid
)
{
@auth_headers
[
'uid'
]
}
let
(
:access_token
)
{
@auth_headers
[
'access-token'
]
}
let
(
:role
)
{
Role
.
all
}
before
do
@user
=
create
(
:user
,
roles:
[
role
.
find_by
(
name:
'moderator'
)])
@auth_headers
=
@user
.
create_new_auth_token
end
end
RSpec
.
shared_context
"authenticate_user_editor"
,
shared_context: :metadata
do
let
(
:auth_client
)
{
@auth_headers
[
'client'
]
}
let
(
:uid
)
{
@auth_headers
[
'uid'
]
}
let
(
:access_token
)
{
@auth_headers
[
'access-token'
]
}
let
(
:role
)
{
Role
.
all
}
before
do
@user
=
create
(
:user
,
roles:
[
role
.
find_by
(
name:
'editor'
)])
@auth_headers
=
@user
.
create_new_auth_token
end
end
RSpec
.
shared_context
"authenticate_user_supervisor"
,
shared_context: :metadata
do
let
(
:auth_client
)
{
@auth_headers
[
'client'
]
}
let
(
:uid
)
{
@auth_headers
[
'uid'
]
}
let
(
:access_token
)
{
@auth_headers
[
'access-token'
]
}
let
(
:role
)
{
Role
.
all
}
before
do
@user
=
create
(
:user
,
roles:
[
role
.
find_by
(
name:
'supervisor'
)])
@auth_headers
=
@user
.
create_new_auth_token
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment