mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Merge pull request #11241 from dacook/rubocop-layout-1
Fix Rubocop Layout violations - 1
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 1400 --no-auto-gen-timestamp`
|
||||
# using RuboCop version 1.54.1.
|
||||
# using RuboCop version 1.54.2.
|
||||
# The point is for the user to remove these configuration records
|
||||
# one by one as the offenses are removed from the code base.
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
@@ -16,88 +16,7 @@ Gemspec/RequiredRubyVersion:
|
||||
- 'engines/order_management/order_management.gemspec'
|
||||
- 'engines/web/web.gemspec'
|
||||
|
||||
# Offense count: 32
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: with_first_argument, with_fixed_indentation
|
||||
Layout/ArgumentAlignment:
|
||||
Exclude:
|
||||
- 'app/controllers/spree/users_controller.rb'
|
||||
- 'app/controllers/user_confirmations_controller.rb'
|
||||
- 'app/models/enterprise.rb'
|
||||
- 'spec/lib/reports/packing/packing_report_spec.rb'
|
||||
- 'spec/migrations/migrate_customer_names_spec.rb'
|
||||
- 'spec/services/products_renderer_spec.rb'
|
||||
- 'spec/system/admin/bulk_order_management_spec.rb'
|
||||
- 'spec/system/admin/enterprise_fees_spec.rb'
|
||||
- 'spec/system/admin/order_cycles/list_spec.rb'
|
||||
- 'spec/system/admin/order_cycles/simple_spec.rb'
|
||||
- 'spec/system/consumer/shopping/cart_spec.rb'
|
||||
- 'spec/system/consumer/shopping/products_spec.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: with_first_element, with_fixed_indentation
|
||||
Layout/ArrayAlignment:
|
||||
Exclude:
|
||||
- 'spec/system/admin/customers_spec.rb'
|
||||
- 'spec/system/admin/order_spec.rb'
|
||||
- 'spec/system/admin/orders_spec.rb'
|
||||
- 'spec/system/consumer/shopping/cart_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyleAlignWith.
|
||||
# SupportedStylesAlignWith: either, start_of_block, start_of_line
|
||||
Layout/BlockAlignment:
|
||||
Exclude:
|
||||
- 'spec/services/products_renderer_spec.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Layout/BlockEndNewline:
|
||||
Exclude:
|
||||
- 'spec/lib/open_food_network/enterprise_fee_calculator_spec.rb'
|
||||
- 'spec/system/admin/orders_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Layout/ClosingParenthesisIndentation:
|
||||
Exclude:
|
||||
- 'spec/system/admin/orders_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Layout/EmptyLines:
|
||||
Exclude:
|
||||
- 'app/models/spree/payment.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: empty_lines, no_empty_lines
|
||||
Layout/EmptyLinesAroundBlockBody:
|
||||
Exclude:
|
||||
- 'spec/system/admin/order_cycles/list_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
|
||||
Layout/FirstArgumentIndentation:
|
||||
Exclude:
|
||||
- 'spec/system/admin/orders_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: special_inside_parentheses, consistent, align_braces
|
||||
Layout/FirstHashElementIndentation:
|
||||
Exclude:
|
||||
- 'spec/services/products_renderer_spec.rb'
|
||||
|
||||
# Offense count: 13
|
||||
# Offense count: 9
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
||||
# SupportedHashRocketStyles: key, separator, table
|
||||
@@ -106,13 +25,11 @@ Layout/FirstHashElementIndentation:
|
||||
Layout/HashAlignment:
|
||||
Exclude:
|
||||
- 'app/controllers/spree/users_controller.rb'
|
||||
- 'spec/migrations/migrate_customer_names_spec.rb'
|
||||
- 'spec/models/enterprise_spec.rb'
|
||||
- 'spec/system/admin/customers_spec.rb'
|
||||
- 'spec/system/admin/order_spec.rb'
|
||||
- 'spec/system/admin/orders_spec.rb'
|
||||
- 'spec/system/admin/tag_rules_spec.rb'
|
||||
- 'spec/system/consumer/shopping/cart_spec.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
@@ -124,13 +41,6 @@ Layout/IndentationConsistency:
|
||||
- 'spec/system/admin/order_cycles/simple_spec.rb'
|
||||
- 'spec/system/admin/product_import_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: Width, AllowedPatterns.
|
||||
Layout/IndentationWidth:
|
||||
Exclude:
|
||||
- 'spec/services/products_renderer_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
|
||||
@@ -147,7 +57,7 @@ Layout/LineContinuationSpacing:
|
||||
- 'spec/system/admin/enterprise_fees_spec.rb'
|
||||
- 'spec/system/admin/order_spec.rb'
|
||||
|
||||
# Offense count: 77
|
||||
# Offense count: 92
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
||||
# URISchemes: http, https
|
||||
@@ -161,6 +71,7 @@ Layout/LineLength:
|
||||
- 'spec/controllers/api/v0/order_cycles_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/orders_controller_spec.rb'
|
||||
- 'spec/lib/reports/customers_report_spec.rb'
|
||||
- 'spec/migrations/migrate_customer_names_spec.rb'
|
||||
- 'spec/models/enterprise_spec.rb'
|
||||
- 'spec/models/order_cycle_spec.rb'
|
||||
- 'spec/models/product_importer_spec.rb'
|
||||
@@ -170,11 +81,16 @@ Layout/LineLength:
|
||||
- 'spec/models/spree/product_spec.rb'
|
||||
- 'spec/models/spree/variant_spec.rb'
|
||||
- 'spec/requests/api/orders_spec.rb'
|
||||
- 'spec/services/products_renderer_spec.rb'
|
||||
- 'spec/support/request/web_helper.rb'
|
||||
- 'spec/system/admin/adjustments_spec.rb'
|
||||
- 'spec/system/admin/bulk_order_management_spec.rb'
|
||||
- 'spec/system/admin/customers_spec.rb'
|
||||
- 'spec/system/admin/order_cycles/simple_spec.rb'
|
||||
- 'spec/system/admin/order_spec.rb'
|
||||
- 'spec/system/admin/product_import_spec.rb'
|
||||
- 'spec/system/consumer/shopping/cart_spec.rb'
|
||||
- 'spec/system/consumer/shopping/products_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
@@ -211,7 +127,7 @@ Layout/TrailingEmptyLines:
|
||||
Exclude:
|
||||
- 'Rakefile'
|
||||
|
||||
# Offense count: 76
|
||||
# Offense count: 77
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowInHeredoc.
|
||||
Layout/TrailingWhitespace:
|
||||
@@ -416,7 +332,7 @@ Metrics/AbcSize:
|
||||
- 'lib/tasks/enterprises.rake'
|
||||
- 'spec/services/order_checkout_restart_spec.rb'
|
||||
|
||||
# Offense count: 45
|
||||
# Offense count: 46
|
||||
# Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns.
|
||||
# AllowedMethods: refine
|
||||
Metrics/BlockLength:
|
||||
@@ -1376,7 +1292,7 @@ Style/HashLikeCase:
|
||||
Exclude:
|
||||
- 'app/models/enterprise.rb'
|
||||
|
||||
# Offense count: 1782
|
||||
# Offense count: 1783
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
||||
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
||||
|
||||
@@ -34,7 +34,7 @@ module Spree
|
||||
inner_html(
|
||||
"#login-feedback",
|
||||
partial("layouts/alert",
|
||||
locals: { type: "alert", message: t('devise.failure.already_registered') })
|
||||
locals: { type: "alert", message: t('devise.failure.already_registered') })
|
||||
).
|
||||
dispatch_event(name: "login:modal:open")
|
||||
else
|
||||
@@ -49,8 +49,8 @@ module Spree
|
||||
render cable_ready: cable_car.inner_html(
|
||||
"#signup-feedback",
|
||||
partial("layouts/alert",
|
||||
locals: { type: "success",
|
||||
message: t('devise.user_registrations.spree_user.signed_up_but_unconfirmed') })
|
||||
locals: { type: "success",
|
||||
message: t('devise.user_registrations.spree_user.signed_up_but_unconfirmed') })
|
||||
)
|
||||
else
|
||||
render status: :unprocessable_entity, cable_ready: cable_car.morph(
|
||||
|
||||
@@ -25,7 +25,7 @@ class UserConfirmationsController < DeviseController
|
||||
render cable_ready: cable_car.inner_html(
|
||||
"##{params[:tab] || 'forgot'}-feedback",
|
||||
partial("layouts/alert",
|
||||
locals: { type: "success", message: t("devise.confirmations.send_instructions") })
|
||||
locals: { type: "success", message: t("devise.confirmations.send_instructions") })
|
||||
)
|
||||
return
|
||||
end
|
||||
|
||||
@@ -51,9 +51,9 @@ class Enterprise < ApplicationRecord
|
||||
belongs_to :owner, class_name: 'Spree::User',
|
||||
inverse_of: :owned_enterprises
|
||||
has_many :distributor_payment_methods,
|
||||
inverse_of: :distributor, foreign_key: :distributor_id
|
||||
inverse_of: :distributor, foreign_key: :distributor_id
|
||||
has_many :distributor_shipping_methods,
|
||||
inverse_of: :distributor, foreign_key: :distributor_id
|
||||
inverse_of: :distributor, foreign_key: :distributor_id
|
||||
has_many :payment_methods, through: :distributor_payment_methods
|
||||
has_many :shipping_methods, through: :distributor_shipping_methods
|
||||
has_many :customers
|
||||
@@ -115,10 +115,10 @@ class Enterprise < ApplicationRecord
|
||||
validate :shopfront_producers
|
||||
validate :enforce_ownership_limit, if: lambda { owner_id_changed? && !owner_id.nil? }
|
||||
validates :instagram,
|
||||
format: {
|
||||
with: VALID_INSTAGRAM_REGEX,
|
||||
message: Spree.t('errors.messages.invalid_instagram_url')
|
||||
}, allow_blank: true
|
||||
format: {
|
||||
with: VALID_INSTAGRAM_REGEX,
|
||||
message: Spree.t('errors.messages.invalid_instagram_url')
|
||||
}, allow_blank: true
|
||||
validate :validate_white_label_logo_link
|
||||
|
||||
before_validation :initialize_permalink, if: lambda { permalink.nil? }
|
||||
|
||||
@@ -97,7 +97,6 @@ module Spree
|
||||
transition from: [:void], to: :checkout
|
||||
end
|
||||
|
||||
|
||||
after_transition to: :completed, do: :set_captured_at
|
||||
end
|
||||
|
||||
|
||||
@@ -124,11 +124,14 @@ module OpenFoodNetwork
|
||||
let!(:ef_admin) { create(:enterprise_fee, fee_type: 'admin', amount: 1.23, name: "Admin") }
|
||||
let!(:ef_sales) { create(:enterprise_fee, fee_type: 'sales', amount: 4.56, name: "Sales") }
|
||||
let!(:ef_packing) {
|
||||
create(:enterprise_fee, fee_type: 'packing', amount: 7.89, name: "Packing") }
|
||||
create(:enterprise_fee, fee_type: 'packing', amount: 7.89, name: "Packing")
|
||||
}
|
||||
let!(:ef_transport) {
|
||||
create(:enterprise_fee, fee_type: 'transport', amount: 0.12, name: "Transport") }
|
||||
create(:enterprise_fee, fee_type: 'transport', amount: 0.12, name: "Transport")
|
||||
}
|
||||
let!(:ef_fundraising) {
|
||||
create(:enterprise_fee, fee_type: 'fundraising', amount: 3.45, name: "Fundraising") }
|
||||
create(:enterprise_fee, fee_type: 'fundraising', amount: 3.45, name: "Fundraising")
|
||||
}
|
||||
let!(:exchange) {
|
||||
create(:exchange, order_cycle: order_cycle,
|
||||
sender: coordinator, receiver: distributor, incoming: false,
|
||||
|
||||
@@ -19,7 +19,7 @@ module OpenFoodNetwork
|
||||
end
|
||||
|
||||
describe "merging ProducerProperties and Spree::ProductProperties" do
|
||||
let(:product_property) { create(:product_property, property: property) }
|
||||
let(:product_property) { create(:product_property, property: property) }
|
||||
let(:duplicate_product_property) { create(:producer_property, property: duplicate_property) }
|
||||
let(:producer_property) { create(:producer_property, property: different_property) }
|
||||
|
||||
|
||||
@@ -57,11 +57,11 @@ describe "Packing Reports" do
|
||||
}
|
||||
let(:line_item2) {
|
||||
build(:line_item_with_shipment,
|
||||
product: create(:simple_product, name: "visible", supplier: supplier1))
|
||||
product: create(:simple_product, name: "visible", supplier: supplier1))
|
||||
}
|
||||
let(:line_item3) {
|
||||
build(:line_item_with_shipment,
|
||||
product: create(:simple_product, name: "not visible", supplier: supplier2))
|
||||
product: create(:simple_product, name: "not visible", supplier: supplier2))
|
||||
}
|
||||
|
||||
before do
|
||||
|
||||
@@ -13,11 +13,11 @@ describe MigrateCustomerNames do
|
||||
|
||||
before do
|
||||
Spree::Preference.create(value: true,
|
||||
value_type: "boolean", key: "/enterprise/show_customer_names_to_suppliers/#{enterprise1.id}")
|
||||
value_type: "boolean", key: "/enterprise/show_customer_names_to_suppliers/#{enterprise1.id}")
|
||||
Spree::Preference.create(value: false,
|
||||
value_type: "boolean", key: "/enterprise/show_customer_names_to_suppliers/#{enterprise2.id}")
|
||||
value_type: "boolean", key: "/enterprise/show_customer_names_to_suppliers/#{enterprise2.id}")
|
||||
Spree::Preference.create(value: true,
|
||||
value_type: "boolean", key: "/enterprise/show_customer_names_to_suppliers/#{enterprise4.id}")
|
||||
value_type: "boolean", key: "/enterprise/show_customer_names_to_suppliers/#{enterprise4.id}")
|
||||
end
|
||||
|
||||
describe '#migrate_customer_names_preferences!' do
|
||||
|
||||
@@ -273,7 +273,7 @@ describe CartService do
|
||||
end
|
||||
|
||||
it "returns true when order cycle is provided" do
|
||||
cart_service.instance_variable_set :@order_cycle, double(:order_cycle)
|
||||
cart_service.instance_variable_set :@order_cycle, double(:order_cycle)
|
||||
expect(cart_service.send(:check_order_cycle_provided)).to be true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -25,7 +25,7 @@ describe ProductsRenderer do
|
||||
let!(:product_cherries) {
|
||||
create(:product, name: "cherries", primary_taxon_id: fruits.id,
|
||||
supplier_id: fruits_supplier.id)
|
||||
}
|
||||
}
|
||||
let!(:product_doughnuts) {
|
||||
create(:product, name: "doughnuts", primary_taxon_id: cakes.id,
|
||||
supplier_id: cakes_supplier.id)
|
||||
@@ -70,10 +70,10 @@ describe ProductsRenderer do
|
||||
it "filters products by name_or_meta_keywords_or_variants_display_as_or_" \
|
||||
"variants_display_name_or_supplier_name_cont" do
|
||||
products_renderer = ProductsRenderer.new(distributor, order_cycle, customer, { q: {
|
||||
"#{[:name, :meta_keywords, :variants_display_as,
|
||||
:variants_display_name, :supplier_name]
|
||||
.join('_or_')}_cont": "apples",
|
||||
} })
|
||||
"#{[:name, :meta_keywords, :variants_display_as,
|
||||
:variants_display_name, :supplier_name]
|
||||
.join('_or_')}_cont": "apples",
|
||||
} })
|
||||
products = products_renderer.send(:products)
|
||||
expect(products).to eq([product_apples])
|
||||
end
|
||||
@@ -88,7 +88,7 @@ describe ProductsRenderer do
|
||||
product_apples.product_properties.create!({ property_id: property_organic.id,
|
||||
value: '1', position: 1 })
|
||||
products_renderer = ProductsRenderer.new(distributor, order_cycle, customer,
|
||||
{ q: { with_properties: [property_organic.id] } })
|
||||
{ q: { with_properties: [property_organic.id] } })
|
||||
products = products_renderer.send(:products)
|
||||
expect(products).to eq([product_apples])
|
||||
end
|
||||
@@ -97,7 +97,7 @@ describe ProductsRenderer do
|
||||
fruits_supplier.producer_properties.create!({ property_id: property_organic.id,
|
||||
value: '1', position: 1 })
|
||||
products_renderer = ProductsRenderer.new(distributor, order_cycle, customer,
|
||||
{ q: { with_properties: [property_organic.id] } })
|
||||
{ q: { with_properties: [property_organic.id] } })
|
||||
products = products_renderer.send(:products)
|
||||
expect(products).to eq([product_apples, product_cherries])
|
||||
end
|
||||
@@ -115,7 +115,7 @@ describe ProductsRenderer do
|
||||
product_doughnuts.product_properties.create!({ property_id: property_organic.id,
|
||||
value: '1', position: 1 })
|
||||
products_renderer = ProductsRenderer.new(distributor, order_cycle, customer,
|
||||
{ q: { with_properties: [property_organic.id] } })
|
||||
{ q: { with_properties: [property_organic.id] } })
|
||||
products = products_renderer.send(:products)
|
||||
expect(products).to eq([product_cherries, product_banana_bread, product_doughnuts])
|
||||
end
|
||||
|
||||
@@ -265,7 +265,7 @@ describe '
|
||||
it "displays a column for user's full name" do
|
||||
expect(page).to have_selector "th.full_name", text: "NAME"
|
||||
expect(page).to have_selector "td.full_name",
|
||||
text: "#{o1.bill_address.last_name}, #{o1.bill_address.first_name}"
|
||||
text: "#{o1.bill_address.last_name}, #{o1.bill_address.first_name}"
|
||||
expect(page).to have_selector "td.full_name", text: ""
|
||||
end
|
||||
|
||||
@@ -790,7 +790,7 @@ describe '
|
||||
end
|
||||
|
||||
it "displays only line items whose orders meet the date restriction criteria, when changed",
|
||||
retry: 3 do
|
||||
retry: 3 do
|
||||
from = today - 8.days
|
||||
to = today + 1.day
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ code: nil, created_manually: true)
|
||||
# Prompts for a hub for a list of my managed enterprises
|
||||
expect(page)
|
||||
.to have_select2 "shop_id", with_options: [managed_distributor1.name,
|
||||
managed_distributor2.name], without_options: [unmanaged_distributor.name]
|
||||
managed_distributor2.name], without_options: [unmanaged_distributor.name]
|
||||
|
||||
select2_select managed_distributor2.name, from: "shop_id"
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ describe '
|
||||
select 'Admin', from: "#{prefix}_fee_type"
|
||||
fill_in "#{prefix}_name", with: 'Greetings!'
|
||||
select 'Inherit From Product',
|
||||
from: "#{prefix}_tax_category_id"
|
||||
from: "#{prefix}_tax_category_id"
|
||||
select 'Flat Percent', from: "#{prefix}_calculator_type"
|
||||
click_button 'Update'
|
||||
end
|
||||
@@ -126,11 +126,11 @@ describe '
|
||||
|
||||
it "handle when updating calculator type for Weight to Flat Rate" do
|
||||
select 'Weight (per kg or lb)',
|
||||
from: "#{prefix}_calculator_type"
|
||||
from: "#{prefix}_calculator_type"
|
||||
click_button 'Update'
|
||||
|
||||
select 'Flat Rate (per item)',
|
||||
from: "#{prefix}_calculator_type"
|
||||
from: "#{prefix}_calculator_type"
|
||||
click_button 'Update'
|
||||
|
||||
expect(fee.reload.calculator_type).to eq("Calculator::PerItem")
|
||||
@@ -157,7 +157,7 @@ describe '
|
||||
|
||||
# editing to an invalid combination
|
||||
select 'Flat Rate (per order)',
|
||||
from: "#{prefix}_calculator_type"
|
||||
from: "#{prefix}_calculator_type"
|
||||
expect{ click_button 'Update' }.to_not change { fee.reload.calculator_type }
|
||||
expect(page).to have_content "Inheriting the tax categeory requires a per-item calculator."
|
||||
end
|
||||
@@ -218,7 +218,7 @@ describe '
|
||||
# After saving, we should be redirected to the fees for our chosen enterprise
|
||||
expect(page).
|
||||
not_to have_select 'sets_enterprise_fee_set_collection_attributes_1_enterprise_id',
|
||||
selected: 'Second Distributor'
|
||||
selected: 'Second Distributor'
|
||||
|
||||
# A new enterprise fee is created
|
||||
expect(EnterpriseFee.count).to eq(fee_count)
|
||||
@@ -229,7 +229,7 @@ describe '
|
||||
context "an error message is displayed" do
|
||||
message = 'Inheriting the tax categeory requires a per-item calculator.'
|
||||
it_behaves_like "setting it up", 'Inherit From Product',
|
||||
'Flat Rate (per order)', message, 0
|
||||
'Flat Rate (per order)', message, 0
|
||||
end
|
||||
|
||||
context "an success message is displayed" do
|
||||
|
||||
@@ -145,7 +145,7 @@ describe '
|
||||
|
||||
within("tr.order-cycle-#{oc_pt.id}") do
|
||||
expect(find('input.datetimepicker',
|
||||
match: :first).value).to start_with oc_open_at.strftime("%Y-%m-%d %H:%M")
|
||||
match: :first).value).to start_with oc_open_at.strftime("%Y-%m-%d %H:%M")
|
||||
find('input.datetimepicker', match: :first).click
|
||||
end
|
||||
|
||||
@@ -158,7 +158,7 @@ match: :first).value).to start_with oc_open_at.strftime("%Y-%m-%d %H:%M")
|
||||
|
||||
within("tr.order-cycle-#{oc_pt.id}") do
|
||||
expect(find('input.datetimepicker',
|
||||
match: :first).value).to eq oc_open_at.strftime("%Y-%m-13 %H:%M")
|
||||
match: :first).value).to eq oc_open_at.strftime("%Y-%m-13 %H:%M")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -186,9 +186,8 @@ match: :first).value).to eq oc_open_at.strftime("%Y-%m-13 %H:%M")
|
||||
# Check the value is correct
|
||||
within("tr.order-cycle-#{oc_pt.id}") do
|
||||
expect(find('input.datetimepicker',
|
||||
match: :first).value).to eq test_value.to_datetime.strftime("%Y-%m-%d %H:%M")
|
||||
match: :first).value).to eq test_value.to_datetime.strftime("%Y-%m-%d %H:%M")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -343,7 +343,7 @@ describe '
|
||||
expect(page).to have_field 'order_cycle_name', with: oc.name
|
||||
select2_select schedule.name, from: 'schedule_ids'
|
||||
expect(page).not_to have_select2 'schedule_ids',
|
||||
with_options: [schedule_of_other_managed_distributor.name]
|
||||
with_options: [schedule_of_other_managed_distributor.name]
|
||||
|
||||
click_button 'Save and Next'
|
||||
|
||||
@@ -620,9 +620,9 @@ describe '
|
||||
|
||||
expect(page).to have_input "oc#{oc.id}[name]", value: "Plums & Avos"
|
||||
expect(page).to have_input "oc#{oc.id}[orders_open_at]",
|
||||
value: Time.zone.local(2040, 10, 17, 0o6, 0o0, 0o0).strftime("%F %T %z"), visible: false
|
||||
value: Time.zone.local(2040, 10, 17, 0o6, 0o0, 0o0).strftime("%F %T %z"), visible: false
|
||||
expect(page).to have_input "oc#{oc.id}[orders_close_at]",
|
||||
value: Time.zone.local(2040, 10, 24, 17, 0o0, 0o0).strftime("%F %T %z"), visible: false
|
||||
value: Time.zone.local(2040, 10, 24, 17, 0o0, 0o0).strftime("%F %T %z"), visible: false
|
||||
|
||||
# And it should have some variants selected
|
||||
expect(oc.exchanges.incoming.first.variants.count).to eq(2)
|
||||
@@ -730,9 +730,9 @@ describe '
|
||||
|
||||
expect(page).to have_input "oc#{oc.id}[name]", value: "Plums & Avos"
|
||||
expect(page).to have_input "oc#{oc.id}[orders_open_at]",
|
||||
value: Time.zone.local(2040, 10, 17, 0o6, 0o0, 0o0).strftime("%F %T %z"), visible: false
|
||||
value: Time.zone.local(2040, 10, 17, 0o6, 0o0, 0o0).strftime("%F %T %z"), visible: false
|
||||
expect(page).to have_input "oc#{oc.id}[orders_close_at]",
|
||||
value: Time.zone.local(2040, 10, 24, 17, 0o0, 0o0).strftime("%F %T %z"), visible: false
|
||||
value: Time.zone.local(2040, 10, 24, 17, 0o0, 0o0).strftime("%F %T %z"), visible: false
|
||||
|
||||
# And it should have a variant selected
|
||||
expect(oc.exchanges.incoming.first.variants).to eq([v2])
|
||||
|
||||
@@ -739,7 +739,7 @@ distributors: [distributor1])
|
||||
"in an existing order " do
|
||||
before do
|
||||
distributor1.shipping_methods = [shipping_method_for_distributor1,
|
||||
different_shipping_method_for_distributor1]
|
||||
different_shipping_method_for_distributor1]
|
||||
order.shipments.each(&:refresh_rates)
|
||||
order.shipment.adjustments.first.open
|
||||
order.select_shipping_method(different_shipping_method_for_distributor1)
|
||||
|
||||
@@ -41,11 +41,12 @@ describe '
|
||||
distributors: [distributor, distributor2, distributor3])
|
||||
}
|
||||
let!(:shipping_method2) {
|
||||
create(:shipping_method_with, :pickup, name: "delivery",
|
||||
distributors: [distributor4, distributor5]) }
|
||||
create(:shipping_method_with, :pickup, name: "delivery",
|
||||
distributors: [distributor4, distributor5])
|
||||
}
|
||||
let(:order_cycle) do
|
||||
create(:simple_order_cycle, name: 'One', distributors: [distributor, distributor2,
|
||||
distributor3, distributor4],
|
||||
distributor3, distributor4],
|
||||
variants: [product.variants.first])
|
||||
end
|
||||
|
||||
@@ -481,16 +482,16 @@ distributors: [distributor4, distributor5]) }
|
||||
# select all orders
|
||||
page.find("#listing_orders thead th:first-child input[type=checkbox]").click
|
||||
expect(page.find(
|
||||
"#listing_orders tbody tr td:first-child input[type=checkbox]")
|
||||
).to be_checked
|
||||
"#listing_orders tbody tr td:first-child input[type=checkbox]")
|
||||
).to be_checked
|
||||
# enables print invoices button
|
||||
page.find("span.icon-reorder", text: "ACTIONS").click
|
||||
expect(page).to have_content "Print Invoices"
|
||||
# unselect all orders
|
||||
page.find("#listing_orders thead th:first-child input[type=checkbox]").trigger("click")
|
||||
expect(page.find(
|
||||
"#listing_orders tbody tr td:first-child input[type=checkbox]")
|
||||
).to_not be_checked
|
||||
"#listing_orders tbody tr td:first-child input[type=checkbox]")
|
||||
).to_not be_checked
|
||||
# disables print invoices button
|
||||
page.find("span.icon-reorder", text: "ACTIONS").click
|
||||
expect(page).to_not have_content "Print Invoices"
|
||||
|
||||
@@ -18,7 +18,7 @@ describe "full-page cart" do
|
||||
create(:simple_order_cycle, suppliers: [supplier], distributors: [distributor],
|
||||
coordinator: create(:distributor_enterprise),
|
||||
variants: [product_with_tax.variants.first,
|
||||
product_with_fee.variants.first])
|
||||
product_with_fee.variants.first])
|
||||
}
|
||||
let(:enterprise_fee) {
|
||||
create(:enterprise_fee, amount: 11.00, tax_category: product_with_tax.tax_category)
|
||||
@@ -144,7 +144,7 @@ describe "full-page cart" do
|
||||
context "order with 2 line items" do
|
||||
let(:admin_fee) {
|
||||
create(:enterprise_fee, calculator: Calculator::Weight.new(preferred_per_unit: 1,
|
||||
preferred_unit_from_list: "kg"),
|
||||
preferred_unit_from_list: "kg"),
|
||||
enterprise: order_cycle.coordinator, fee_type: 'admin')
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ describe "As a consumer I want to view products" do
|
||||
expect(page).to have_content product.name
|
||||
|
||||
expect_product_description_html_to_be_displayed(product, "<p>Safe</p>",
|
||||
"<script>alert('Dangerous!');</script>", truncate: false)
|
||||
"<script>alert('Dangerous!');</script>", truncate: false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ describe 'Shops' do
|
||||
|
||||
it "does not show hubs that are not in an order cycle" do
|
||||
expect(page).to have_no_selector 'hub.inactive'
|
||||
expect(page).to have_no_selector 'hub', text: d2.name
|
||||
expect(page).to have_no_selector 'hub', text: d2.name
|
||||
end
|
||||
|
||||
it "does not show profiles" do
|
||||
|
||||
Reference in New Issue
Block a user