require 'rails_helper' RSpec.describe 'GET /api/products/:product_id/reviews', type: :request do let!(:product) { create(:product, public_id: SecureRandom.hex(12)) } before(:each) do create_list(:product_review, 26, product:) end it_behaves_like 'a GET index request' do let(:headers) { {} } let(:route) { "/api/products/#{product.public_id}/reviews" } let(:pagination_size) { 15 } end describe '?by=:user_account_id' do it 'tells if a product has a review made by the user with the id' do user = create(:user_account) create(:product_review, user_account: user, product:) get "/api/products/#{product.public_id}/reviews?by=#{user.id}" expect(response).to have_http_status(200) expect(response.body).to include('true') end end end