More rebase fix

This commit is contained in:
Gaetan Craig-Riou
2024-07-03 12:04:18 +10:00
parent fb2575aaeb
commit cfc51f399f
4 changed files with 17 additions and 8 deletions

View File

@@ -3,7 +3,7 @@
module ProductsHelper
def create_products(amount)
amount.times do |i|
create(:simple_product, name: "product #{i}", supplier: producer)
create(:simple_product, name: "product #{i}", supplier_id: producer.id)
end
end
@@ -41,6 +41,13 @@ module ProductsHelper
"tr:has(input[aria-label=Name][value='#{value}'])"
end
# Selector for table row that has an input with a placeholder.
# Variant don't have display_name set, so we look for the input with placeholder matching the
# product's name to get the variant row
def row_containing_placeholder(value)
"tr:has(input[aria-label=Name][placeholder='#{value}'])"
end
# Wait for an element with the given CSS selector and class to be present
def wait_for_class(selector, class_name)
max_wait_time = Capybara.default_max_wait_time

View File

@@ -255,12 +255,12 @@ RSpec.describe '
describe "deleting" do
let!(:product1) {
create(:simple_product, name: 'a product to keep', supplier_id: @supplier.id)
create(:simple_product, name: 'a product to keep', supplier_id: supplier.id)
}
context 'a simple product' do
let!(:product2) {
create(:simple_product, name: 'a product to delete', supplier_id: @supplier.id
create(:simple_product, name: 'a product to delete', supplier_id: supplier.id)
}
before do
@@ -311,7 +311,7 @@ RSpec.describe '
describe 'cloning' do
let!(:product1) {
create(:simple_product, name: 'a weight product', supplier_id: @supplier.id,
create(:simple_product, name: 'a weight product', supplier_id: supplier.id,
variant_unit: "weight")
}

View File

@@ -53,8 +53,8 @@ RSpec.describe 'As an enterprise user, I can manage my products', feature: :admi
s1 = FactoryBot.create(:supplier_enterprise)
s2 = FactoryBot.create(:supplier_enterprise)
s3 = FactoryBot.create(:supplier_enterprise)
p1 = FactoryBot.create(:product, supplier: s2)
p2 = FactoryBot.create(:product, supplier: s3)
p1 = FactoryBot.create(:product, supplier_id: s2.id)
p2 = FactoryBot.create(:product, supplier_id: s3.id)
visit spree.admin_products_path
@@ -269,7 +269,9 @@ RSpec.describe 'As an enterprise user, I can manage my products', feature: :admi
# create a product with a different supplier
let!(:producer1) { create(:supplier_enterprise, name: "Producer 1") }
let!(:product_by_supplier) { create(:simple_product, name: "Apples", supplier: producer1) }
let!(:product_by_supplier) {
create(:simple_product, name: "Apples", supplier_id: producer1.id)
}
before { user.enterprise_roles.create(enterprise: producer1) }

View File

@@ -418,7 +418,7 @@ RSpec.describe '
expect(page).to have_table_row ["Supplier", "Producer Suburb", "Product",
"Product Properties", "Taxons", "Variant Value", "Price",
"Group Buy Unit Quantity", "Amount", "SKU",
"On Demand?", "On hand"]
"On Demand?", "On Hand"]
expect(page).to have_table_row [supplier.name, supplier.address.city,
"Product Name",
product1.properties.map(&:presentation).join(", "),