summaryrefslogtreecommitdiff
path: root/spec/requests/addresses_controller/show_spec.rb
blob: aaa97fb06ce4102354b4dade46063139cc86a1ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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