blob: 9b2461c80e2f765ec4d646eff9074cc99f69cef1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'GET /api/products/:public_id', type: :request do
it_behaves_like 'a GET resource request' do
let(:headers) { {} }
let(:product) { create(:product, public_id: SecureRandom.hex(12)) }
let(:route) { "/api/products/#{product.public_id}" }
let(:invalid_route) { "/api/products/#{Faker::Lorem.word}" }
let(:expected_text) do
product.categories.concat([product.name, product.id.to_s, product.unitary_price.to_i.to_s,
product.bulk_price.to_i.to_s, product.available_quantity.to_s, product.company.name,
product.company.short_name])
end
end
end
|