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

post in lo not working correctely yet

parent 8b4321eb
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,12 @@ resource 'Learning Objects' do ...@@ -6,6 +6,12 @@ resource 'Learning Objects' do
before { 12.times { create(:learning_object) } } before { 12.times { create(:learning_object) } }
let(:learning_objects) { LearningObject.all } let(:learning_objects) { LearningObject.all }
let(:object_types) { ObjectType.all }
let(:languages) { Language.all }
let(:licenses) { License.all }
let(:subject) { Subject.all }
let(:educational_stage) { EducationalStage.all }
let(:tag) { Tag.all }
get '/v1/learning_objects' do get '/v1/learning_objects' do
parameter :limit, 'Limit of learning objects' parameter :limit, 'Limit of learning objects'
...@@ -32,6 +38,40 @@ resource 'Learning Objects' do ...@@ -32,6 +38,40 @@ resource 'Learning Objects' do
end end
end end
post '/v1/learning_objects' do
include_context "authenticate_user"
parameter :author, 'The author of a educational content'
parameter :name, 'The name of the learning object'
parameter :description, 'The description of educational content of the learning object'
parameter :link, 'Object link, when don’t have any attachments'
parameter :software, 'If some software is needed to run the object'
parameter :tags, 'Array with tags (by name)'
parameter :subjects, 'Array with subjects ids'
parameter :educational_stages, 'Array with educational stages ids'
parameter :object_type_id, 'The id of object type'
parameter :language_id, 'The id of a language'
parameter :license_id, 'The id of a license'
let(:author) { Faker::Name.name }
let(:name) { Faker::Name.name }
let(:description) { Faker::Lorem.paragraph }
let(:object_type_id) { object_types.first.id }
let(:language_id) { languages.first.id }
let(:license_id) { licenses.first.id }
let(:software) { Faker::Lorem::sentence }
let(:link) { Faker::Internet.url }
let(:tags) { [ name: tag.first.name, name: tag.last.name ] }
let(:subjects) { [ subject.first.id ] }
let(:educational_stages) { [ educational_stage.first.id ] }
let(:raw_post) { params.to_json }
example 'Creating a learning_object draft' do
do_request
expect(status).to eq(201)
end
end
post '/v1/learning_objects/:id/like' do post '/v1/learning_objects/:id/like' do
include_context "authenticate_user" 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