From 1506dde0e2b4ebac58399dcb184110b4b2a3734b Mon Sep 17 00:00:00 2001 From: Giovanne Marcelo <gms15@inf.ufpr.br> Date: Thu, 16 Feb 2017 19:26:32 -0200 Subject: [PATCH] Add create review test --- spec/acceptance/reviews_spec.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/spec/acceptance/reviews_spec.rb b/spec/acceptance/reviews_spec.rb index e808278b..2e012b18 100644 --- a/spec/acceptance/reviews_spec.rb +++ b/spec/acceptance/reviews_spec.rb @@ -24,6 +24,32 @@ resource 'Reviews' do end + post '/v1/:type/:id/reviews' do + include_context 'authenticate_user' + + parameter :id, 'The id of object' + parameter :type, 'type of object [\'learning_objects\', \'collections\']' + parameter :name, 'The title of review', scope: :review + parameter :description, 'A short description', scope: :review + parameter :pros, 'Pros description', scope: :review + parameter :cons, 'Cons description', scope: :review + parameter :review_ratings_attributes, 'Ratings of attributes belonging to the review', scope: :review + + let(:type) { 'learning_objects' } + let(:id) { learning_objects.first.id } + let(:name) { Faker::Lorem::word } + let(:description) { Faker::Lorem::sentence } + let(:pros) { Faker::Lorem::sentence} + let(:cons) { Faker::Lorem::sentence} + let(:review_ratings_attributes) { [ { rating_id: 1, value: 3} ] } + let(:raw_post) { params.to_json } + + example_request 'Creating a Review' do + expect(status).to eq(201) + end + end + + post '/v1/:type/:id/reviews/:review_id/rate' do include_context 'authenticate_user' -- GitLab