summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/addresses_controller/index_spec.rb2
-rw-r--r--spec/requests/addresses_controller/show_spec.rb21
2 files changed, 22 insertions, 1 deletions
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