Skip to content
Snippets Groups Projects
Commit 9c16b83e authored by Marcela Ribeiro de Oliveira's avatar Marcela Ribeiro de Oliveira
Browse files

create subjects acceptance test

parent 67fcbbeb
No related branches found
No related tags found
No related merge requests found
......@@ -4,9 +4,10 @@ resource 'Subjects' do
header 'Accept', 'application/json'
header 'Content-Type', 'application/json'
before { 12.times { create(:subject) } }
before { 12.times { create(:subject); create(:learning_object) } }
let(:subjects) { Subject.all }
let(:subject) { Subject.all }
let(:learning_objects) { LearningObject.all }
get '/v1/subjects' do
parameter :limit, 'Limit of subjects'
......@@ -22,4 +23,25 @@ resource 'Subjects' do
end
end
post 'v1/:type/:id/subjects' do
include_context "authenticate_user"
parameter :id, "The id of the object"
parameter :type, "Represents the type of the object [LearningObject, Collection]"
parameter :subjects, "The array of subjects"
let(:type) {'learning_objects'}
let(:id) {@learning_object.id}
let(:subjects) { [subject.first.id ] }
let(:raw_post) {params.to_json}
before do
@learning_object = create(:learning_object, publisher: @user)
end
example 'Adding subjects' do
do_request
expect(status).to eq(201)
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