diff --git a/spec/acceptance/collections_spec.rb b/spec/acceptance/collections_spec.rb index f669a25e09788994287aae3aa62ce774e70010cb..a3d636d5740b375499246654f24765cd0958ad56 100644 --- a/spec/acceptance/collections_spec.rb +++ b/spec/acceptance/collections_spec.rb @@ -10,6 +10,38 @@ resource 'Collections' do let(:collections) { Collection.all } let(:learning_objects) { LearningObject.all } + let(:_subjects) { Subject.all } + let(:_educational_stages) { EducationalStage.all } + + post '/v1/collections' do + include_context "authenticate_user" + + parameter :name, 'The name of the collection', scope: :collection + parameter :description, 'The description of educational content of the collection', scope: :collection + parameter :owner_id, 'The id of the collection’s owner', scope: :collection + parameter :owner_type, 'Represents a type of the collections owner [User, Institution]', scope: :collection + parameter :privacy, 'Represents if collections is public, or not. [public, private]', scope: :collection + parameter :items, 'Items belongs to the collection [LearningObject, Collection]', scope: :collection + parameter :tags, 'Array with tags', scope: :collection + parameter :subjects, 'Array with subjects', scope: :collection + parameter :educational_stages, 'Array with educational stages', scope: :collection + + let(:name) { Faker::Lorem.word } + let(:description) { Faker::Lorem.sentence } + let(:owner_id) { @user.id } + let(:owner_type) { 'User' } + let(:privacy) { 'public' } + let(:items) { [ { id: learning_objects.first.id, type: "LearningObject", position: 0 } ] } + let(:tags) { [ { name: Faker::Lorem.word} ] } + let(:educational_stages) { [_educational_stages.first.id, _educational_stages.second.id] } + let(:subjects) { [_subjects.first.id, _subjects.second.id] } + let(:raw_post) { params.to_json } + + example 'Creating a collection' do + do_request + expect(status).to eq(201) + end + end get '/v1/collections' do parameter :limit, 'Limit of collections'