mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-06 02:51:34 +00:00
Remove I18n keys in system admin specs
This commit is contained in:
@@ -104,7 +104,7 @@ describe '
|
||||
click_link 'Adjustments'
|
||||
|
||||
expect(page).to_not have_selector('tr a.icon-edit')
|
||||
expect(page).to_not have_selector('a.icon-plus'), text: I18n.t(:new_adjustment)
|
||||
expect(page).to_not have_selector('a.icon-plus'), text: 'New Adjustment'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -136,7 +136,7 @@ describe '
|
||||
|
||||
it "displays a column for order date" do
|
||||
expect(page).to have_selector "th.date",
|
||||
text: I18n.t("admin.orders.bulk_management.order_date").upcase
|
||||
text: 'Completed at'.upcase
|
||||
expect(page).to have_selector "td.date", text: o1.completed_at.strftime('%B %d, %Y')
|
||||
expect(page).to have_selector "td.date", text: o2.completed_at.strftime('%B %d, %Y')
|
||||
end
|
||||
@@ -344,7 +344,7 @@ describe '
|
||||
it "displays the default selected columns" do
|
||||
expect(page).to have_selector "th", text: "NAME"
|
||||
expect(page).to have_selector "th",
|
||||
text: I18n.t("admin.orders.bulk_management.order_date").upcase
|
||||
text: 'Completed at'.upcase
|
||||
expect(page).to have_selector "th", text: "PRODUCER"
|
||||
expect(page).to have_selector "th", text: "PRODUCT: UNIT"
|
||||
expect(page).to have_selector "th", text: "QUANTITY"
|
||||
@@ -360,7 +360,7 @@ describe '
|
||||
expect(page).to have_no_selector "th", text: "PRODUCER"
|
||||
expect(page).to have_selector "th", text: "NAME"
|
||||
expect(page).to have_selector "th",
|
||||
text: I18n.t("admin.orders.bulk_management.order_date").upcase
|
||||
text: 'Completed at'.upcase
|
||||
expect(page).to have_selector "th", text: "PRODUCT: UNIT"
|
||||
expect(page).to have_selector "th", text: "QUANTITY"
|
||||
expect(page).to have_selector "th", text: "MAX"
|
||||
|
||||
@@ -183,7 +183,7 @@ describe '
|
||||
let(:hub) { create(:distributor_enterprise) }
|
||||
let!(:override) { create(:variant_override, variant: variant, hub: hub ) }
|
||||
let(:variant_overrides_tip) {
|
||||
I18n.t('spree.admin.products.index.products_variant.variant_has_n_overrides', n: 1)
|
||||
"This variant has %d override(s)" % 1
|
||||
}
|
||||
|
||||
it "displays an icon indicating a variant has overrides" do
|
||||
|
||||
@@ -89,7 +89,7 @@ describe 'Customers' do
|
||||
end
|
||||
end
|
||||
expect(page).to have_selector "#info-dialog .text",
|
||||
text: I18n.t('admin.customers.destroy.has_associated_subscriptions')
|
||||
text: 'Delete failed: This customer has active subscriptions. Cancel them first.'
|
||||
click_button "OK"
|
||||
}.to_not change{ Customer.count }
|
||||
|
||||
@@ -191,7 +191,7 @@ describe 'Customers' do
|
||||
find(:css, "tags-input .tags input").set "awesome\n"
|
||||
expect(page).to have_css ".tag_watcher.update-pending"
|
||||
end
|
||||
expect(page).to have_content I18n.t('admin.unsaved_changes')
|
||||
expect(page).to have_content 'You have unsaved changes'
|
||||
click_button "Save Changes"
|
||||
|
||||
# Every says it updated
|
||||
|
||||
@@ -156,9 +156,9 @@ create(:enterprise)
|
||||
|
||||
within '#invite-manager-modal' do
|
||||
fill_in 'invite_email', with: new_email
|
||||
click_button I18n.t('js.admin.modals.invite')
|
||||
expect(page).to have_content I18n.t('user_invited', email: new_email)
|
||||
click_button I18n.t('js.admin.modals.close')
|
||||
click_button 'Invite'
|
||||
expect(page).to have_content "#{new_email} has been invited to manage this enterprise"
|
||||
click_button 'Close'
|
||||
end
|
||||
|
||||
expect(page).not_to have_selector "#invite-manager-modal"
|
||||
|
||||
@@ -117,7 +117,7 @@ describe '
|
||||
# Attempting to edit dates of an open order cycle with active subscriptions
|
||||
find("#oc#{oc1.id}_orders_open_at").click
|
||||
expect(page).to have_selector "#confirm-dialog .message",
|
||||
text: I18n.t('admin.order_cycles.date_warning.msg', n: 1)
|
||||
text: date_warning_msg(1)
|
||||
end
|
||||
|
||||
describe 'listing order cycles with other locales' do
|
||||
@@ -189,4 +189,8 @@ describe '
|
||||
page.find("table.exchanges tr.supplier-#{supplier.id} td.products").click
|
||||
check "order_cycle_incoming_exchange_#{exchange_no}_variants_#{variant.id}"
|
||||
end
|
||||
|
||||
def date_warning_msg(nbr = 1)
|
||||
"This order cycle is linked to %d open subscription orders. Changing this date now will not affect any orders which have already been placed, but should be avoided if possible. Are you sure you want to proceed?" % nbr
|
||||
end
|
||||
end
|
||||
|
||||
@@ -308,7 +308,7 @@ describe '
|
||||
|
||||
visit edit_admin_order_cycle_path(oc)
|
||||
|
||||
expect(page).to have_content I18n.t("admin.order_cycles.edit.re_notify_producers").upcase
|
||||
expect(page).to have_content 'Re notify producers'.upcase
|
||||
end
|
||||
|
||||
it "allows removing exchanges" do
|
||||
|
||||
@@ -309,7 +309,7 @@ describe '
|
||||
expect(page).to have_content "Customer Details updated"
|
||||
click_link "Order Details"
|
||||
|
||||
expect(page).to have_content I18n.t('spree.add_product').upcase
|
||||
expect(page).to have_content 'Add Product'.upcase
|
||||
select2_select product.name, from: 'add_variant_id', search: true
|
||||
|
||||
within("table.stock-levels") do
|
||||
@@ -463,7 +463,7 @@ describe '
|
||||
expect(page).to have_selector "fieldset#order-total", text: order.display_total
|
||||
|
||||
# shows the order tax adjustments
|
||||
within('fieldset', text: I18n.t('spree.admin.orders.form.line_item_adjustments').upcase) do
|
||||
within('fieldset', text: 'Line Item Adjustments'.upcase) do
|
||||
expect(page).to have_selector "td", match: :first, text: "Tax 1"
|
||||
expect(page).to have_selector "td.total", text: Spree::Money.new(10)
|
||||
end
|
||||
|
||||
@@ -70,15 +70,15 @@ describe '
|
||||
|
||||
select2_select "Missing", from: "payment_method_preferred_enterprise_id"
|
||||
expect(page).to have_selector "#stripe-account-status .alert-box.error",
|
||||
text: I18n.t("spree.admin.payment_methods.stripe_connect.account_missing_msg")
|
||||
connect_one = I18n.t("spree.admin.payment_methods.stripe_connect.connect_one")
|
||||
text: 'No Stripe account exists for this enterprise.'
|
||||
connect_one = 'Connect One'
|
||||
expect(page).to have_link connect_one,
|
||||
href: edit_admin_enterprise_path(missing_account_enterprise,
|
||||
anchor: "/payment_methods")
|
||||
|
||||
select2_select "Revoked", from: "payment_method_preferred_enterprise_id"
|
||||
expect(page).to have_selector "#stripe-account-status .alert-box.error",
|
||||
text: I18n.t("spree.admin.payment_methods.stripe_connect.access_revoked_msg")
|
||||
text: 'Access to this Stripe account has been revoked, please reconnect your account.'
|
||||
|
||||
select2_select "Connected", from: "payment_method_preferred_enterprise_id"
|
||||
expect(page).to have_selector "#stripe-account-status .status", text: "Status: Connected"
|
||||
|
||||
@@ -14,7 +14,7 @@ describe '
|
||||
it "displays the order balance as the default payment amount" do
|
||||
login_as_admin_and_visit spree.new_admin_order_payment_path order
|
||||
|
||||
expect(page).to have_content I18n.t(:new_payment)
|
||||
expect(page).to have_content 'New Payment'
|
||||
expect(page).to have_field(:payment_amount, with: order.outstanding_balance.to_f)
|
||||
end
|
||||
end
|
||||
@@ -32,7 +32,7 @@ describe '
|
||||
it "renders the new payment page" do
|
||||
login_as_admin_and_visit spree.new_admin_order_payment_path order
|
||||
|
||||
expect(page).to have_content I18n.t(:new_payment)
|
||||
expect(page).to have_content 'New Payment'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ describe "Product Import", js: true do
|
||||
|
||||
wait_until { page.find("a.button.view").present? }
|
||||
|
||||
click_link I18n.t('admin.product_import.save_results.view_products')
|
||||
click_link 'Go To Products Page'
|
||||
|
||||
expect(page).to have_content 'Bulk Edit Products'
|
||||
wait_until { page.find("#p_#{potatoes.id}").present? }
|
||||
@@ -216,7 +216,7 @@ describe "Product Import", js: true do
|
||||
potatoes = Spree::Product.find_by(name: 'Potatoes')
|
||||
expect(potatoes.variants.first.import_date).to be_within(1.minute).of Time.zone.now
|
||||
|
||||
click_link I18n.t('admin.product_import.save_results.view_products')
|
||||
click_link 'Go To Products Page'
|
||||
|
||||
wait_until { page.find("#p_#{carrots.id}").present? }
|
||||
|
||||
@@ -321,7 +321,7 @@ describe "Product Import", js: true do
|
||||
File.write('/tmp/test.csv', csv_data)
|
||||
|
||||
visit main_app.admin_product_import_path
|
||||
select I18n.t('admin.product_import.index.inventories'), from: "settings_import_into"
|
||||
select 'Inventories', from: "settings_import_into"
|
||||
attach_file 'file', '/tmp/test.csv'
|
||||
click_button 'Upload'
|
||||
|
||||
@@ -357,7 +357,7 @@ describe "Product Import", js: true do
|
||||
expect(Float(cabbage_override.price)).to eq 1.50
|
||||
expect(cabbage_override.count_on_hand).to eq 2001
|
||||
|
||||
click_link I18n.t('admin.product_import.save_results.view_inventory')
|
||||
click_link 'Go To Inventory Page'
|
||||
expect(page).to have_content 'Inventory'
|
||||
|
||||
select enterprise2.name, from: "hub_id", visible: false
|
||||
@@ -382,7 +382,7 @@ describe "Product Import", js: true do
|
||||
File.write('/tmp/test.csv', csv_data)
|
||||
|
||||
visit main_app.admin_product_import_path
|
||||
select I18n.t('admin.product_import.index.inventories'), from: "settings_import_into"
|
||||
select 'Inventories', from: "settings_import_into"
|
||||
attach_file 'file', '/tmp/test.csv'
|
||||
click_button 'Upload'
|
||||
|
||||
@@ -420,7 +420,7 @@ describe "Product Import", js: true do
|
||||
|
||||
File.write('/tmp/test.csv', csv_data)
|
||||
visit main_app.admin_product_import_path
|
||||
select I18n.t('admin.product_import.index.inventories'), from: "settings_import_into"
|
||||
select 'Inventories', from: "settings_import_into"
|
||||
attach_file 'file', '/tmp/test.csv'
|
||||
click_button 'Upload'
|
||||
proceed_to_validation
|
||||
@@ -452,7 +452,7 @@ describe "Product Import", js: true do
|
||||
|
||||
File.write('/tmp/test.csv', csv_data)
|
||||
visit main_app.admin_product_import_path
|
||||
select I18n.t('admin.product_import.index.inventories'), from: "settings_import_into"
|
||||
select 'Inventories', from: "settings_import_into"
|
||||
attach_file 'file', '/tmp/test.csv'
|
||||
click_button 'Upload'
|
||||
proceed_to_validation
|
||||
@@ -482,7 +482,7 @@ describe "Product Import", js: true do
|
||||
File.write('/tmp/test.csv', csv_data)
|
||||
|
||||
visit main_app.admin_product_import_path
|
||||
select I18n.t('admin.product_import.index.inventories'), from: "settings_import_into"
|
||||
select 'Inventories', from: "settings_import_into"
|
||||
attach_file 'file', '/tmp/test.csv'
|
||||
click_button 'Upload'
|
||||
|
||||
@@ -683,7 +683,7 @@ describe "Product Import", js: true do
|
||||
expect(page).to have_content 'Select a spreadsheet to upload'
|
||||
click_button 'Upload'
|
||||
|
||||
expect(flash_message).to eq I18n.t(:product_import_file_not_found_notice)
|
||||
expect(flash_message).to eq 'File not found or could not be opened'
|
||||
end
|
||||
|
||||
it "handles cases where no meaningful data can be read from the file" do
|
||||
@@ -712,8 +712,7 @@ describe "Product Import", js: true do
|
||||
expect(page).to have_no_selector '.create-count'
|
||||
expect(page).to have_no_selector '.update-count'
|
||||
expect(page).to have_no_selector 'input[type=submit][value="Save"]'
|
||||
expect(flash_message).to match(I18n.t('admin.product_import.model.malformed_csv',
|
||||
error_message: ""))
|
||||
expect(flash_message).to match("Product Import encountered a malformed CSV: %s" % '')
|
||||
|
||||
File.delete('/tmp/test.csv')
|
||||
end
|
||||
@@ -741,7 +740,7 @@ describe "Product Import", js: true do
|
||||
|
||||
proceed_to_validation
|
||||
|
||||
expect(page).to have_content I18n.t('admin.product_import.import.validation_overview')
|
||||
expect(page).to have_content 'Import validation overview'
|
||||
expect(page).to have_selector '.item-count', text: "2"
|
||||
expect(page).to have_selector '.invalid-count', text: "1"
|
||||
expect(page).to have_selector '.create-count', text: "1"
|
||||
@@ -767,11 +766,11 @@ describe "Product Import", js: true do
|
||||
it "validates and saves all batches" do
|
||||
# Upload and validate file.
|
||||
attach_file "file", csv_file
|
||||
click_button I18n.t("admin.product_import.index.upload")
|
||||
click_button 'Upload'
|
||||
proceed_to_validation
|
||||
|
||||
# Check that all rows are validated.
|
||||
heading = I18n.t('admin.product_import.import.products_to_create')
|
||||
heading = 'Products will be created'
|
||||
find(".header-description", text: heading).click
|
||||
expect(page).to have_content "Imported Product 10"
|
||||
expect(page).to have_content "Imported Product 60"
|
||||
@@ -794,9 +793,9 @@ describe "Product Import", js: true do
|
||||
|
||||
def proceed_to_validation
|
||||
expect(page).to have_selector 'a.button.proceed'
|
||||
within("#content") { click_link I18n.t('admin.product_import.import.import') }
|
||||
within("#content") { click_link 'Import' }
|
||||
expect(page).to have_selector 'form.product-import'
|
||||
expect(page).to have_content I18n.t('admin.product_import.import.validation_overview')
|
||||
expect(page).to have_content 'Import validation overview'
|
||||
end
|
||||
|
||||
def save_data
|
||||
@@ -807,7 +806,7 @@ describe "Product Import", js: true do
|
||||
end
|
||||
|
||||
def proceed_with_save
|
||||
click_link I18n.t("admin.product_import.import.save")
|
||||
click_link 'Save'
|
||||
end
|
||||
|
||||
def expect_import_completed
|
||||
|
||||
@@ -312,44 +312,44 @@ describe '
|
||||
|
||||
# Link back to the bulk product update page should include the filters
|
||||
expected_admin_product_url = Regexp.new(Regexp.escape("#{spree.admin_products_path}#?#{filter.to_query}"))
|
||||
expect(page).to have_link(I18n.t('admin.products.back_to_products_list'),
|
||||
expect(page).to have_link('Back to products list',
|
||||
href: expected_admin_product_url)
|
||||
expect(page).to have_link(I18n.t(:cancel), href: expected_admin_product_url)
|
||||
expect(page).to have_link('Cancel', href: expected_admin_product_url)
|
||||
|
||||
expected_product_url = Regexp.new(Regexp.escape(spree.edit_admin_product_path(
|
||||
product.permalink, filter
|
||||
)))
|
||||
expect(page).to have_link(I18n.t('admin.products.tabs.product_details'),
|
||||
expect(page).to have_link('Product Details',
|
||||
href: expected_product_url)
|
||||
|
||||
expected_product_image_url = Regexp.new(Regexp.escape(spree.admin_product_images_path(
|
||||
product.permalink, filter
|
||||
)))
|
||||
expect(page).to have_link(I18n.t('admin.products.tabs.images'),
|
||||
expect(page).to have_link('Images',
|
||||
href: expected_product_image_url)
|
||||
|
||||
expected_product_variant_url = Regexp.new(Regexp.escape(spree.admin_product_variants_path(
|
||||
product.permalink, filter
|
||||
)))
|
||||
expect(page).to have_link(I18n.t('admin.products.tabs.variants'),
|
||||
expect(page).to have_link('Variants',
|
||||
href: expected_product_variant_url)
|
||||
|
||||
expected_product_properties_url = Regexp.new(Regexp.escape(spree.admin_product_product_properties_path(
|
||||
product.permalink, filter
|
||||
)))
|
||||
expect(page).to have_link(I18n.t('admin.products.tabs.product_properties'),
|
||||
expect(page).to have_link('Product Properties',
|
||||
href: expected_product_properties_url)
|
||||
|
||||
expected_product_group_buy_option_url = Regexp.new(Regexp.escape(spree.group_buy_options_admin_product_path(
|
||||
product.permalink, filter
|
||||
)))
|
||||
expect(page).to have_link(I18n.t('admin.products.tabs.group_buy_options'),
|
||||
expect(page).to have_link('Group Buy Options',
|
||||
href: expected_product_group_buy_option_url)
|
||||
|
||||
expected_product_seo_url = Regexp.new(Regexp.escape(spree.seo_admin_product_path(
|
||||
product.permalink, filter
|
||||
)))
|
||||
expect(page).to have_link(I18n.t(:search), href: expected_product_seo_url)
|
||||
expect(page).to have_link('Search', href: expected_product_seo_url)
|
||||
end
|
||||
|
||||
it "editing product group buy options" do
|
||||
@@ -375,7 +375,7 @@ describe '
|
||||
|
||||
expected_cancel_link = Regexp.new(Regexp.escape(spree.edit_admin_product_path(product,
|
||||
filter)))
|
||||
expect(page).to have_link(I18n.t(:cancel), href: expected_cancel_link)
|
||||
expect(page).to have_link('Cancel', href: expected_cancel_link)
|
||||
end
|
||||
|
||||
it "editing product group buy options with url filter" do
|
||||
@@ -411,7 +411,7 @@ describe '
|
||||
|
||||
expected_cancel_link = Regexp.new(Regexp.escape(spree.edit_admin_product_path(product,
|
||||
filter)))
|
||||
expect(page).to have_link(I18n.t(:cancel), href: expected_cancel_link)
|
||||
expect(page).to have_link('Cancel', href: expected_cancel_link)
|
||||
end
|
||||
|
||||
it "editing product Search with url filter" do
|
||||
@@ -440,7 +440,7 @@ describe '
|
||||
expected_cancel_link = Regexp.new(Regexp.escape(spree.admin_product_product_properties_path(
|
||||
product, filter
|
||||
)))
|
||||
expect(page).to have_link(I18n.t(:cancel), href: expected_cancel_link)
|
||||
expect(page).to have_link('Cancel', href: expected_cancel_link)
|
||||
end
|
||||
|
||||
it "deleting product properties", js: true do
|
||||
@@ -526,7 +526,7 @@ describe '
|
||||
|
||||
expected_cancel_link = Regexp.new(Regexp.escape(spree.admin_product_images_path(product,
|
||||
filter)))
|
||||
expect(page).to have_link(I18n.t(:cancel), href: expected_cancel_link)
|
||||
expect(page).to have_link('Cancel', href: expected_cancel_link)
|
||||
end
|
||||
|
||||
it "upload a new product image including url filters", js: true do
|
||||
@@ -552,7 +552,7 @@ describe '
|
||||
expected_new_image_link = Regexp.new(Regexp.escape(spree.new_admin_product_image_path(
|
||||
product, filter
|
||||
)))
|
||||
expect(page).to have_link(I18n.t('spree.new_image'), href: expected_new_image_link)
|
||||
expect(page).to have_link('New Image', href: expected_new_image_link)
|
||||
end
|
||||
|
||||
it "loading edit product image page including url filter", js: true do
|
||||
@@ -571,7 +571,7 @@ describe '
|
||||
|
||||
expected_cancel_link = Regexp.new(Regexp.escape(spree.admin_product_images_path(product,
|
||||
filter)))
|
||||
expect(page).to have_link(I18n.t(:cancel), href: expected_cancel_link)
|
||||
expect(page).to have_link('Cancel', href: expected_cancel_link)
|
||||
expect(page).to have_link("Back To Images List", href: expected_cancel_link)
|
||||
end
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ describe "enterprise fee summaries" do
|
||||
let(:current_user) { create(:admin_user) }
|
||||
|
||||
it "shows link and allows access to the report" do
|
||||
click_on I18n.t("admin.reports.enterprise_fee_summary.name")
|
||||
click_on 'Enterprise Fee Summary'
|
||||
expect(page).to have_button("Go")
|
||||
end
|
||||
end
|
||||
@@ -35,7 +35,7 @@ describe "enterprise fee summaries" do
|
||||
let(:current_user) { distributor.owner }
|
||||
|
||||
it "shows link and allows access to the report" do
|
||||
click_on I18n.t("admin.reports.enterprise_fee_summary.name")
|
||||
click_on 'Enterprise Fee Summary'
|
||||
expect(page).to have_button("Go")
|
||||
end
|
||||
end
|
||||
@@ -44,9 +44,9 @@ describe "enterprise fee summaries" do
|
||||
let(:current_user) { create(:user) }
|
||||
|
||||
it "does not allow access to the report" do
|
||||
expect(page).to have_no_link(I18n.t("admin.reports.enterprise_fee_summary.name"))
|
||||
expect(page).to have_no_link('Enterprise Fee Summary')
|
||||
visit main_app.admin_report_path(report_type: 'enterprise_fee_summary')
|
||||
expect(page).to have_content(I18n.t("unauthorized"))
|
||||
expect(page).to have_content('Unauthorized')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -80,7 +80,7 @@ describe "Sales Tax Totals By Producer" do
|
||||
it "generates the report" do
|
||||
login_as admin
|
||||
visit admin_reports_path
|
||||
click_on I18n.t("admin.reports.sales_tax_totals_by_producer")
|
||||
click_on 'Sales Tax Totals By Producer'
|
||||
|
||||
expect(page).to have_button("Go")
|
||||
click_on "Go"
|
||||
@@ -141,7 +141,7 @@ describe "Sales Tax Totals By Producer" do
|
||||
it "generates the report" do
|
||||
login_as admin
|
||||
visit admin_reports_path
|
||||
click_on I18n.t("admin.reports.sales_tax_totals_by_producer")
|
||||
click_on 'Sales Tax Totals By Producer'
|
||||
|
||||
expect(page).to have_button("Go")
|
||||
click_on "Go"
|
||||
@@ -328,7 +328,7 @@ describe "Sales Tax Totals By Producer" do
|
||||
end
|
||||
login_as admin
|
||||
visit admin_reports_path
|
||||
click_on I18n.t("admin.reports.sales_tax_totals_by_producer")
|
||||
click_on 'Sales Tax Totals By Producer'
|
||||
end
|
||||
|
||||
it "should load all the orders" do
|
||||
|
||||
@@ -104,26 +104,26 @@ describe '
|
||||
table_headers = rows.map { |r| r.all("th").map { |c| c.text.strip } }
|
||||
|
||||
expect(table_headers).to eq([
|
||||
[I18n.t("report_header_order_date"),
|
||||
I18n.t("report_header_order_id"),
|
||||
I18n.t("report_header_customer_name"),
|
||||
I18n.t("report_header_customer_email"),
|
||||
I18n.t("report_header_customer_phone"),
|
||||
I18n.t("report_header_customer_city"),
|
||||
I18n.t("report_header_sku"),
|
||||
I18n.t("report_header_item_name"),
|
||||
I18n.t("report_header_variant"),
|
||||
I18n.t("report_header_quantity"),
|
||||
I18n.t("report_header_max_quantity"),
|
||||
I18n.t("report_header_cost"),
|
||||
I18n.t("report_header_shipping_cost"),
|
||||
I18n.t("report_header_payment_method"),
|
||||
I18n.t("report_header_distributor"),
|
||||
I18n.t("report_header_distributor_address"),
|
||||
I18n.t("report_header_distributor_city"),
|
||||
I18n.t("report_header_distributor_postcode"),
|
||||
I18n.t("report_header_shipping_method"),
|
||||
I18n.t("report_header_shipping_instructions")]
|
||||
['Order date',
|
||||
'Order Id',
|
||||
'Customer Name',
|
||||
'Customer Email',
|
||||
'Customer Phone',
|
||||
'Customer City',
|
||||
'SKU',
|
||||
'Item name',
|
||||
'Variant',
|
||||
'Quantity',
|
||||
'Max Quantity',
|
||||
'Cost',
|
||||
'Shipping Cost',
|
||||
'Payment Method',
|
||||
'Distributor',
|
||||
'Distributor address',
|
||||
'Distributor city',
|
||||
'Distributor postcode',
|
||||
'Shipping Method',
|
||||
'Shipping instructions']
|
||||
.map(&:upcase)
|
||||
])
|
||||
|
||||
@@ -142,10 +142,10 @@ describe '
|
||||
table_headers = rows.map { |r| r.all("th").map { |c| c.text.strip } }
|
||||
|
||||
expect(table_headers).to eq([
|
||||
[I18n.t("report_header_payment_state"),
|
||||
I18n.t("report_header_distributor"),
|
||||
I18n.t("report_header_payment_type"),
|
||||
I18n.t("report_header_total_price", currency: currency_symbol)]
|
||||
['Payment State',
|
||||
'Distributor',
|
||||
'Payment Type',
|
||||
"Total (%s)" % currency_symbol]
|
||||
.map(&:upcase)
|
||||
])
|
||||
|
||||
|
||||
@@ -33,9 +33,9 @@ describe 'shipping methods' do
|
||||
check "shipping_method_distributor_ids_#{distributor1.id}"
|
||||
check "shipping_method_distributor_ids_#{distributor2.id}"
|
||||
check "shipping_method_shipping_categories_"
|
||||
click_button I18n.t("actions.create")
|
||||
click_button 'Create'
|
||||
|
||||
expect(page).to have_no_button I18n.t("actions.create")
|
||||
expect(page).to have_no_button 'Create'
|
||||
|
||||
# Then the shipping method should have its distributor set
|
||||
expect(flash_message).to include "Carrier Pidgeon", "successfully created!"
|
||||
|
||||
@@ -417,7 +417,7 @@ describe 'Subscriptions' do
|
||||
|
||||
# Can't use a Stripe payment method because customer does not allow it
|
||||
select2_select stripe_payment_method.name, from: 'payment_method_id'
|
||||
expect(page).to have_content I18n.t('admin.subscriptions.details.charges_not_allowed')
|
||||
expect(page).to have_content 'Charges are not allowed by this customer'
|
||||
click_button 'Save Changes'
|
||||
expect(page).to have_content 'Credit card charges are not allowed by this customer'
|
||||
select2_select payment_method.name, from: 'payment_method_id'
|
||||
@@ -504,7 +504,7 @@ describe 'Subscriptions' do
|
||||
expect(page).to have_content 'Saved'
|
||||
|
||||
expect(page).to have_selector "#order_update_issues_dialog .message",
|
||||
text: I18n.t("admin.subscriptions.order_update_issues_msg")
|
||||
text: 'Some orders could not be automatically updated, this is most likely because they have been manually edited. Please review the issues listed below and make any adjustments to individual orders if required.'
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -732,7 +732,6 @@ describe 'Subscriptions' do
|
||||
end
|
||||
|
||||
def variant_not_in_open_or_upcoming_order_cycle_warning
|
||||
I18n.t("not_in_open_and_upcoming_order_cycles_warning",
|
||||
scope: "admin.subscriptions.subscription_line_items")
|
||||
'There are no open or upcoming order cycles for this product.'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -277,9 +277,9 @@ describe "
|
||||
expect(page).to have_input "variant-overrides-#{variant.id}-price", with: '77.77',
|
||||
placeholder: '1.23'
|
||||
expect(page).to have_input "variant-overrides-#{variant.id}-count_on_hand", with: "",
|
||||
placeholder: I18n.t("js.variants.on_demand.yes")
|
||||
placeholder: 'On demand'
|
||||
expect(page).to have_select "variant-overrides-#{variant.id}-on_demand",
|
||||
selected: I18n.t("js.variant_overrides.on_demand.yes")
|
||||
selected: 'Yes'
|
||||
|
||||
expect(page).to have_input "variant-overrides-#{variant2.id}-count_on_hand",
|
||||
with: "40", placeholder: ""
|
||||
@@ -306,22 +306,22 @@ describe "
|
||||
|
||||
it "updates on_demand settings" do
|
||||
select_on_demand variant, :no
|
||||
click_button I18n.t("save_changes")
|
||||
expect(page).to have_content I18n.t("js.changes_saved")
|
||||
click_button 'Save Changes'
|
||||
expect(page).to have_content 'Changes saved.'
|
||||
|
||||
vo.reload
|
||||
expect(vo.on_demand).to eq(false)
|
||||
|
||||
select_on_demand variant, :yes
|
||||
click_button I18n.t("save_changes")
|
||||
expect(page).to have_content I18n.t("js.changes_saved")
|
||||
click_button 'Save Changes'
|
||||
expect(page).to have_content 'Changes saved.'
|
||||
|
||||
vo.reload
|
||||
expect(vo.on_demand).to eq(true)
|
||||
|
||||
select_on_demand variant, :use_producer_settings
|
||||
click_button I18n.t("save_changes")
|
||||
expect(page).to have_content I18n.t("js.changes_saved")
|
||||
click_button 'Save Changes'
|
||||
expect(page).to have_content 'Changes saved.'
|
||||
|
||||
vo.reload
|
||||
expect(vo.on_demand).to be_nil
|
||||
@@ -407,8 +407,8 @@ describe "
|
||||
expect(page).to have_input "variant-overrides-#{variant.id}-count_on_hand", with: ""
|
||||
|
||||
# It saves the changes.
|
||||
click_button I18n.t("save_changes")
|
||||
expect(page).to have_content I18n.t("js.changes_saved")
|
||||
click_button 'Save Changes'
|
||||
expect(page).to have_content 'Changes saved.'
|
||||
vo.reload
|
||||
expect(vo.count_on_hand).to be_nil
|
||||
expect(vo.on_demand).to be_nil
|
||||
@@ -418,17 +418,17 @@ describe "
|
||||
# Successfully change stock settings.
|
||||
select_on_demand variant, :no
|
||||
fill_in "variant-overrides-#{variant.id}-count_on_hand", with: "1111"
|
||||
click_button I18n.t("save_changes")
|
||||
expect(page).to have_content I18n.t("js.changes_saved")
|
||||
click_button 'Save Changes'
|
||||
expect(page).to have_content 'Changes saved.'
|
||||
|
||||
# Make stock settings incompatible.
|
||||
select_on_demand variant, :no
|
||||
fill_in "variant-overrides-#{variant.id}-count_on_hand", with: ""
|
||||
|
||||
# It does not save the changes.
|
||||
click_button I18n.t("save_changes")
|
||||
expect(page).to have_content I18n.t("activerecord.errors.models.variant_override.count_on_hand.limited_stock_but_no_count_on_hand")
|
||||
expect(page).to have_no_content I18n.t("js.changes_saved")
|
||||
click_button 'Save Changes'
|
||||
expect(page).to have_content 'must be specified because forcing limited stock'
|
||||
expect(page).to have_no_content 'Changes saved.'
|
||||
|
||||
vo.reload
|
||||
expect(vo.count_on_hand).to eq(1111)
|
||||
|
||||
@@ -43,7 +43,7 @@ describe '
|
||||
expected_cancel_url = Regexp.new(
|
||||
Regexp.escape(spree.admin_product_variants_path(product, filter))
|
||||
)
|
||||
expect(page).to have_link(I18n.t('actions.cancel'), href: expected_cancel_url)
|
||||
expect(page).to have_link('Cancel', href: expected_cancel_url)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -96,7 +96,7 @@ describe '
|
||||
expected_cancel_url = Regexp.new(
|
||||
Regexp.escape(spree.admin_product_variants_path(product, filter))
|
||||
)
|
||||
expect(page).to have_link(I18n.t('actions.cancel'), href: expected_cancel_url)
|
||||
expect(page).to have_link('Cancel', href: expected_cancel_url)
|
||||
end
|
||||
|
||||
it "when variant_unit is weight" do
|
||||
|
||||
Reference in New Issue
Block a user