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
3abd5295
Commit
3abd5295
authored
8 years ago
by
Giovanne Marcelo
Browse files
Options
Downloads
Patches
Plain Diff
Add unlike test
parent
4eacfa06
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
+18
-0
18 additions, 0 deletions
spec/acceptance/learning_objects_spec.rb
spec/shared/contexts.rb
+2
-1
2 additions, 1 deletion
spec/shared/contexts.rb
with
20 additions
and
1 deletion
spec/acceptance/learning_objects_spec.rb
+
18
−
0
View file @
3abd5295
...
...
@@ -46,4 +46,22 @@ resource 'Learning Objects' do
end
end
delete
'/v1/learning_objects/:id/like'
do
include_context
"authenticate_user"
let
(
:id
)
{
learning_objects
.
first
.
id
}
before
do
create
(
:like
,
user:
@user
,
likeable:
learning_objects
.
first
)
end
example
'Unliking a learning object'
do
likes
=
learning_objects
.
first
.
likes
.
count
do_request
expect
(
path
).
to
eq
(
"/v1/learning_objects/
#{
id
}
/like"
)
expect
(
JSON
.
parse
(
response_body
)[
'count'
]).
to
eq
(
likes
-
1
)
expect
(
status
).
to
eq
(
200
)
end
end
end
This diff is collapsed.
Click to expand it.
spec/shared/contexts.rb
+
2
−
1
View file @
3abd5295
...
...
@@ -9,7 +9,8 @@ RSpec.shared_context "authenticate_user", shared_context: :metadata do
let
(
:access_token
)
{
@auth_headers
[
'access-token'
]
}
before
do
@auth_headers
=
create
(
:user
).
create_new_auth_token
@user
=
create
(
:user
)
@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