From 332feb3066c7e0fd497311424ffe12c557f49fdd Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Sun, 21 May 2023 10:00:50 -0600 Subject: Corrige errores en AddressesController --- spec/requests/addresses_controller/index_spec.rb | 2 +- spec/requests/addresses_controller/show_spec.rb | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 spec/requests/addresses_controller/show_spec.rb (limited to 'spec/requests/addresses_controller') diff --git a/spec/requests/addresses_controller/index_spec.rb b/spec/requests/addresses_controller/index_spec.rb index 63fc776..b64d5e3 100644 --- a/spec/requests/addresses_controller/index_spec.rb +++ b/spec/requests/addresses_controller/index_spec.rb @@ -16,4 +16,4 @@ RSpec.describe 'GET /api/account/addresses', type: :request do let(:route) { '/api/account/addresses' } let(:pagination_size) { 5 } end -end \ No newline at end of file +end diff --git a/spec/requests/addresses_controller/show_spec.rb b/spec/requests/addresses_controller/show_spec.rb new file mode 100644 index 0000000..aaa97fb --- /dev/null +++ b/spec/requests/addresses_controller/show_spec.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe 'GET /api/account/addreses/:id', type: :request do + it_behaves_like 'a GET resource request' do + let(:user) { create(:user_account) } + let(:token) { jwt(user) } + let(:headers) { { 'Authorization' => "Bearer #{token['token']}" } } + let(:address) do + address = create(:address) + user.addresses << address + user.save + address.save + address + end + let(:route) { "/api/account/addresses/#{address.id.to_s}" } + let(:invalid_route) { "/api/account/addresses/#{Faker::Lorem.word}" } + let(:expected_text) { [address.street, address.id.to_s, address.zip_code, address.city, address.country] } + end +end -- cgit v1.2.3