summaryrefslogtreecommitdiff
path: root/spec/requests/products_controller/destroy_products_controller_spec.rb
blob: 54a57d2031231e299902a525f1d240ee30b304c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe 'DELETE /api/products/product_id', type: :request do
  let(:user) { create(:user_account, role: 'master') }
  let(:token) { jwt(user) }
  let(:headers) { { 'Authorization' => "Bearer #{token['token']}" } }

  it_behaves_like 'a DELETE request' do
    let(:product) { create(:product, public_id: SecureRandom.hex(12)) }
    let(:resource) { "/api/products/#{product.public_id}" }
    let(:nonexistent_resource) { "/api/products/#{SecureRandom.hex(8)}" }
  end
end