From 3e106dc7f5fbd6961c67f41aea66033c27b5142f Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Sat, 18 Mar 2023 12:15:43 -0600 Subject: AƱade spec de products_controller#show MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../products_controller/show_products_controller_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 spec/requests/products_controller/show_products_controller_spec.rb (limited to 'spec/requests') diff --git a/spec/requests/products_controller/show_products_controller_spec.rb b/spec/requests/products_controller/show_products_controller_spec.rb new file mode 100644 index 0000000..3ef5148 --- /dev/null +++ b/spec/requests/products_controller/show_products_controller_spec.rb @@ -0,0 +1,16 @@ +# 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_s, product.bulk_price.to_s, + product.available_quantity.to_s, product.company.name, product.company.short_name]) + end + end +end -- cgit v1.2.3