Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ def index
Spree::Product.includes(
:variant_images,
master: :prices,
variants: :prices
variants: :prices,
variants_including_master: {stock_items: :stock_location}
),
param: :q,
distinct: false
Expand Down
14 changes: 14 additions & 0 deletions admin/spec/requests/solidus_admin/products_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@
allow_any_instance_of(SolidusAdmin::BaseController).to receive(:spree_current_user).and_return(admin_user)
end

describe "GET #index" do
Comment thread
tvdeyen marked this conversation as resolved.
before { create_list(:product, 3) }

it "renders successfully" do
Comment thread
tvdeyen marked this conversation as resolved.
get solidus_admin.products_path
expect(response).to have_http_status(:ok)
end

it "loads stock for every product without an N+1" do
Comment thread
tvdeyen marked this conversation as resolved.
expect { get solidus_admin.products_path }
.to make_database_queries(matching: /from .spree_stock_items./i, count: 1)
Comment thread
tvdeyen marked this conversation as resolved.
end
end

describe "PATCH #update" do
let(:product) { create(:product) }
let(:params) do
Expand Down
Loading