From 0993e0f6f6f45e117b21cd802394d0ca082c4326 Mon Sep 17 00:00:00 2001 From: John Hampton Date: Sun, 1 Jul 2018 00:46:19 -0400 Subject: [PATCH 1/2] Remove verification restriction for mentor requests --- .../api/v1/airtable/mentorships_controller.rb | 6 ------ .../v1/airtable/mentorships_controller_test.rb | 15 --------------- 2 files changed, 21 deletions(-) diff --git a/app/controllers/api/v1/airtable/mentorships_controller.rb b/app/controllers/api/v1/airtable/mentorships_controller.rb index 0eb8d59c..f3dec1e7 100644 --- a/app/controllers/api/v1/airtable/mentorships_controller.rb +++ b/app/controllers/api/v1/airtable/mentorships_controller.rb @@ -13,8 +13,6 @@ def index end def create - verify_user! - mentor_request = ::Airtable::Mentorship.new.create_mentor_request(mentorship_params) render json: mentor_request, status: :created @@ -33,10 +31,6 @@ def mentorship_params :mentor_requested ) end - - def verify_user! - raise ::Airtable::Error, 'User must be verified to request mentor services' unless current_user.verified? - end end end end diff --git a/test/controllers/api/v1/airtable/mentorships_controller_test.rb b/test/controllers/api/v1/airtable/mentorships_controller_test.rb index 9b38a5c4..670df1c0 100644 --- a/test/controllers/api/v1/airtable/mentorships_controller_test.rb +++ b/test/controllers/api/v1/airtable/mentorships_controller_test.rb @@ -69,19 +69,4 @@ class Api::V1::Airtable::MentorshipsControllerTest < ActionDispatch::Integration assert response.parsed_body['createdTime'].present? end end - - test ':create when user is not verified it returns a 422 and error message' do - user = create(:user, verified: false) - headers = authorization_headers(user) - - post( - api_v1_airtable_mentorships_url, - params: {}, - headers: headers, - as: :json - ) - - assert response.status == 422 - assert response.parsed_body['error'].present? - end end From ca11a016ce475e2ce7ceeb0b78e53d1335d70e4a Mon Sep 17 00:00:00 2001 From: John Hampton Date: Tue, 10 Jul 2018 21:36:31 -0400 Subject: [PATCH 2/2] Remove unneeded test cassette & folder --- ...erified_it_returns_a_and_error_message.yml | 115 ------------------ 1 file changed, 115 deletions(-) delete mode 100644 test/cassettes/api_v_airtable_mentorships_controller_test/_create_when_user_is_not_verified_it_returns_a_and_error_message.yml diff --git a/test/cassettes/api_v_airtable_mentorships_controller_test/_create_when_user_is_not_verified_it_returns_a_and_error_message.yml b/test/cassettes/api_v_airtable_mentorships_controller_test/_create_when_user_is_not_verified_it_returns_a_and_error_message.yml deleted file mode 100644 index aa0a4730..00000000 --- a/test/cassettes/api_v_airtable_mentorships_controller_test/_create_when_user_is_not_verified_it_returns_a_and_error_message.yml +++ /dev/null @@ -1,115 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: http://maps.googleapis.com/maps/api/geocode/json?address=97201&language=en&sensor=false - body: - encoding: US-ASCII - string: '' - headers: - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - Ruby - response: - status: - code: 200 - message: OK - headers: - Content-Type: - - application/json; charset=UTF-8 - Date: - - Sun, 06 May 2018 19:46:13 GMT - Expires: - - Mon, 07 May 2018 19:46:13 GMT - Access-Control-Allow-Origin: - - "*" - Server: - - mafe - Content-Length: - - '495' - X-Xss-Protection: - - 1; mode=block - X-Frame-Options: - - SAMEORIGIN - Cache-Control: - - public, max-age=86400 - Age: - - '1' - body: - encoding: ASCII-8BIT - string: | - { - "results" : [ - { - "address_components" : [ - { - "long_name" : "97201", - "short_name" : "97201", - "types" : [ "postal_code" ] - }, - { - "long_name" : "Southwest Portland", - "short_name" : "Southwest Portland", - "types" : [ "neighborhood", "political" ] - }, - { - "long_name" : "Portland", - "short_name" : "Portland", - "types" : [ "locality", "political" ] - }, - { - "long_name" : "Multnomah County", - "short_name" : "Multnomah County", - "types" : [ "administrative_area_level_2", "political" ] - }, - { - "long_name" : "Oregon", - "short_name" : "OR", - "types" : [ "administrative_area_level_1", "political" ] - }, - { - "long_name" : "United States", - "short_name" : "US", - "types" : [ "country", "political" ] - } - ], - "formatted_address" : "Portland, OR 97201, USA", - "geometry" : { - "bounds" : { - "northeast" : { - "lat" : 45.519965, - "lng" : -122.665103 - }, - "southwest" : { - "lat" : 45.497957, - "lng" : -122.7193571 - } - }, - "location" : { - "lat" : 45.505603, - "lng" : -122.6882145 - }, - "location_type" : "APPROXIMATE", - "viewport" : { - "northeast" : { - "lat" : 45.519965, - "lng" : -122.665103 - }, - "southwest" : { - "lat" : 45.497957, - "lng" : -122.7193571 - } - } - }, - "place_id" : "ChIJi8MjqD8KlVQRsyr5ZtaBLMI", - "types" : [ "postal_code" ] - } - ], - "status" : "OK" - } - http_version: - recorded_at: Sun, 06 May 2018 19:46:14 GMT -recorded_with: VCR 3.0.3