Skip to content
Snippets Groups Projects
Commit 1f6d389d authored by Giovanne Marcelo's avatar Giovanne Marcelo
Browse files

add destroy collection test

parent 751eefe4
No related branches found
No related tags found
No related merge requests found
......@@ -8,21 +8,20 @@ resource 'Collections' do
before { 12.times { create(:collection) } }
it_behaves_like "a list", '/v1/collections', Collection, 'collections'
let(:collections) { Collection.all }
#
# get '/v1/collections' do
# parameter :limit, 'Limit of collections'
# parameter :offset, 'Offset of collections'
#
# let(:limit) { 12 }
# let(:offset) { 0 }
#
# example_request 'Get a list of collections' do
# expect(JSON.parse(response_body).map { |o| o['id'] }.sort).to eq(Collection.limit(limit).offset(offset).pluck(:id).sort)
# expect(status).to eq(200)
# end
# end
get '/v1/collections' do
parameter :limit, 'Limit of collections'
parameter :offset, 'Offset of collections'
let(:limit) { 12 }
let(:offset) { 0 }
example_request 'Get a list of collections' do
expect(JSON.parse(response_body).map { |o| o['id'] }.sort).to eq(Collection.limit(limit).offset(offset).pluck(:id).sort)
expect(status).to eq(200)
end
end
get '/v1/collections/:id' do
let(:id) { collections.first.id }
......@@ -35,6 +34,22 @@ resource 'Collections' do
end
end
delete '/v1/collections/:id' do
include_context "authenticate_user"
let(:id) { @collection.id }
before do
@collection = create(:collection, owner: @user)
end
example 'Destroying a collection' do
do_request
expect(status).to eq(200)
end
end
post '/v1/collections/:id/like' do
include_context "authenticate_user"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment