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
bf30dc81
Commit
bf30dc81
authored
8 years ago
by
Marcela Ribeiro de Oliveira
Browse files
Options
Downloads
Patches
Plain Diff
index complaints test
parent
90044d28
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
spec/acceptance/complaints_spec.rb
+25
-0
25 additions, 0 deletions
spec/acceptance/complaints_spec.rb
spec/factories/complaints.rb
+8
-0
8 additions, 0 deletions
spec/factories/complaints.rb
spec/factories/complaints_reasons.rb
+5
-0
5 additions, 0 deletions
spec/factories/complaints_reasons.rb
with
38 additions
and
0 deletions
spec/acceptance/complaints_spec.rb
0 → 100644
+
25
−
0
View file @
bf30dc81
require
'acceptance_helpers'
resource
'Complaints'
do
header
'Accept'
,
'application/json'
header
'Content-Type'
,
'application/json'
before
{
12
.
times
{
create
(
:complaint
)
}
}
let
(
:complaints
)
{
Complaint
.
all
}
get
'/v1/complaints'
do
parameter
:limit
,
'Limit of complaints'
parameter
:offset
,
'Offset of complaints'
let
(
:limit
)
{
12
}
let
(
:offset
)
{
0
}
example_request
'Get a list of complaints'
do
# active model serializer may render model associations in different order for collections (array of items), so we're verifing only returned ids
expect
(
JSON
.
parse
(
response_body
).
map
{
|
o
|
o
[
'id'
]
}.
sort
).
to
eq
(
Complaint
.
limit
(
limit
).
offset
(
offset
).
pluck
(
:id
).
sort
)
expect
(
status
).
to
eq
(
200
)
end
end
end
This diff is collapsed.
Click to expand it.
spec/factories/complaints.rb
0 → 100644
+
8
−
0
View file @
bf30dc81
FactoryGirl
.
define
do
factory
:complaint
do
user
complainable
complaint_reason
description
{
Faker
::
Lorem
.
paragraph
}
end
end
This diff is collapsed.
Click to expand it.
spec/factories/complaints_reasons.rb
0 → 100644
+
5
−
0
View file @
bf30dc81
FactoryGirl
.
define
do
factory
:complaint_reason
do
reason
{
Faker
::
Lorem
.
paragraph
}
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