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

add add_items to collection test

parent 6b145a10
No related branches found
No related tags found
No related merge requests found
......@@ -6,9 +6,10 @@ resource 'Collections' do
header 'Accept', 'application/json'
header 'Content-Type', 'application/json'
before { 12.times { create(:collection) } }
before { 12.times { create(:collection); create(:learning_object) } }
let(:collections) { Collection.all }
let(:learning_objects) { LearningObject.all }
get '/v1/collections' do
parameter :limit, 'Limit of collections'
......@@ -50,6 +51,26 @@ resource 'Collections' do
end
post '/v1/collections/:id/items' do
include_context "authenticate_user"
parameter :items, 'Items belongs to the collection', scope: :collection
let(:id) { @collection.id }
let(:items) { [ { id: learning_objects.first.id, type: "LearningObject", position: "4" } ] }
let(:raw_post) { params.to_json }
before do
@collection = create(:collection, owner: @user)
end
example 'Add items to collection' do
do_request
expect(status).to eq(200)
end
end
post '/v1/collections/:id/like' do
include_context "authenticate_user"
......@@ -82,7 +103,4 @@ resource 'Collections' do
end
end
end
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