diff --git a/spec/acceptance/educational_stages_spec.rb b/spec/acceptance/educational_stages_spec.rb index aad09050a1db7f85e517e21ed84709106d5bb8d0..2ffb63e5565e7057a475ee21a39eb29a58ee4178 100644 --- a/spec/acceptance/educational_stages_spec.rb +++ b/spec/acceptance/educational_stages_spec.rb @@ -4,9 +4,10 @@ resource 'Educational Stages' do header 'Accept', 'application/json' header 'Content-Type', 'application/json' - before { 12.times { create(:educational_stage) } } + before { 12.times { create(:educational_stage); create(:learning_object) } } - let(:educational_stages) { EducationalStage.all } + let(:educationalstages) { EducationalStage.all } + let(:learning_objects) { LearningObject.all } get '/v1/educational_stages' do parameter :limit, 'Limit of educational stages' @@ -22,4 +23,26 @@ resource 'Educational Stages' do end end + post '/v1/:type/:id/educational_stages' do + include_context "authenticate_user" + + parameter :id, 'The id of object' + parameter :type, 'Represents the type of object, [learning_objects, collection]' + + parameter :educational_stages, 'array with the educational_stages ids' + + let(:type) { 'learning_objects' } + let(:id) { @learning_object.id } + let(:educational_stages) { [educationalstages.first.id] } + let(:raw_post) { params.to_json } + + before do + @learning_object = create(:learning_object, publisher: @user) + end + + example_request 'Adding Educational Stages' do + expect(status).to eq(201) + end + end + end