diff options
Diffstat (limited to 'spec/requests/addresses_controller/show_spec.rb')
-rw-r--r-- | spec/requests/addresses_controller/show_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
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 |