Safely autocorrect Layout/TrailingWhitespace

Inspecting 1479 files
...................................................................................................................................................C..C.......................................................................................................C.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C.....C..................C.............................................................................................C...................................................................C.......................................................................................................................................................................C....................................................C.............C...........CC.........C......C.CC.C....................C........................................................

Offenses:

app/controllers/spree/users_controller.rb:36:37: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
            partial("layouts/alert",
                                    ^
app/controllers/spree/users_controller.rb:51:35: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
          partial("layouts/alert",
                                  ^
app/controllers/user_confirmations_controller.rb:27:33: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
        partial("layouts/alert",
                                ^
app/models/enterprise.rb:117:24: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
  validates :instagram,
                       ^
spec/controllers/spree/credit_cards_controller_spec.rb:250:64: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
                  create(:stored_credit_card, user_id: user.id,
                                                               ^
spec/controllers/user_confirmations_controller_spec.rb:45:44: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
        session[:confirmation_return_url] =
                                           ^
spec/factories/order_factory.rb:40:67: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
            order.payments << build(:payment, amount: order.total,
                                                                  ^
spec/lib/reports/packing/packing_report_spec.rb:59:40: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
        build(:line_item_with_shipment,
                                       ^
spec/lib/reports/packing/packing_report_spec.rb:63:40: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
        build(:line_item_with_shipment,
                                       ^
spec/models/enterprise_spec.rb:521:67: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
        expect(Enterprise.supplying_variant_in([p1.variants.first,
                                                                  ^
spec/models/enterprise_spec.rb:906:77: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
      create(:enterprise_relationship, parent: distributor, child: supplier,
                                                                            ^
spec/services/products_renderer_spec.rb:22:73: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
      create(:product, name: "banana bread", primary_taxon_id: cakes.id,
                                                                        ^
spec/services/products_renderer_spec.rb:88:88: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
          product_apples.product_properties.create!({ property_id: property_organic.id,
                                                                                       ^
spec/services/products_renderer_spec.rb:90:87: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
          products_renderer = ProductsRenderer.new(distributor, order_cycle, customer,
                                                                                      ^
spec/services/products_renderer_spec.rb:97:90: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
          fruits_supplier.producer_properties.create!({ property_id: property_organic.id,
                                                                                         ^
spec/services/products_renderer_spec.rb:99:87: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
          products_renderer = ProductsRenderer.new(distributor, order_cycle, customer,
                                                                                      ^
spec/services/products_renderer_spec.rb:109:93: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
          product_apples.product_properties.create!({ property_id: property_conventional.id,
                                                                                            ^
spec/services/products_renderer_spec.rb:111:94: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
          product_banana_bread.product_properties.create!({ property_id: property_organic.id,
                                                                                             ^
spec/services/products_renderer_spec.rb:113:90: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
          product_cherries.product_properties.create!({ property_id: property_organic.id,
                                                                                         ^
spec/services/products_renderer_spec.rb:115:91: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
          product_doughnuts.product_properties.create!({ property_id: property_organic.id,
                                                                                          ^
spec/services/products_renderer_spec.rb:117:87: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
          products_renderer = ProductsRenderer.new(distributor, order_cycle, customer,
                                                                                      ^
spec/support/request/stripe_stubs.rb:17:81: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
  def stub_payment_intent_get_request(response: {}, stripe_account_header: true,
                                                                                ^
spec/support/request/stripe_stubs.rb:172:6: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
    {
     ^
spec/support/request/stripe_stubs.rb:175:24: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
        object: "list",
                       ^
spec/support/request/stripe_stubs.rb:176:25: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
        has_more: false,
                        ^
spec/system/admin/bulk_order_management_spec.rb:792:99: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
      it "displays only line items whose orders meet the date restriction criteria, when changed",
                                                                                                  ^
spec/system/admin/bulk_order_management_spec.rb:1071:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/system/admin/bulk_order_management_spec.rb:1121:82: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
      shared_examples "display only group by information for selected variant" do
                                                                                 ^^^^^^^^^^
spec/system/admin/bulk_order_management_spec.rb:1143:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/system/admin/bulk_order_management_spec.rb:1166:12: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
        end
           ^
spec/system/admin/customers_spec.rb:18:98: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
        create(:customer, first_name: 'John', last_name: 'Doe', enterprise: managed_distributor1,
                                                                                                 ^
spec/system/admin/enterprise_fees_spec.rb:102:37: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
      select 'Inherit From Product',
                                    ^
spec/system/admin/enterprise_fees_spec.rb:128:38: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
      select 'Weight (per kg or lb)',
                                     ^
spec/system/admin/enterprise_fees_spec.rb:132:37: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
      select 'Flat Rate (per item)',
                                    ^
spec/system/admin/enterprise_fees_spec.rb:153:1: C: [Corrected] Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body beginning.
spec/system/admin/enterprise_fees_spec.rb:153:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/system/admin/enterprise_fees_spec.rb:157:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/system/admin/enterprise_fees_spec.rb:159:38: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
      select 'Flat Rate (per order)',
                                     ^
spec/system/admin/enterprise_fees_spec.rb:222:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/system/admin/flatpickr_spec.rb:22:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/system/admin/flatpickr_spec.rb:27:32: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
      find("#admin-menu").click
                               ^^^^^^^
spec/system/admin/flatpickr_spec.rb:32:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/system/admin/flatpickr_spec.rb:34:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/system/admin/flatpickr_spec.rb:41:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/system/admin/order_cycles/complex_editing_spec.rb:74:33: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
    expect(page).to have_select(
                                ^
spec/system/admin/order_cycles/complex_editing_spec.rb:110:33: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
    expect(page).to have_select(
                                ^
spec/system/admin/order_cycles/list_spec.rb:147:46: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
          expect(find('input.datetimepicker',
                                             ^
spec/system/admin/order_cycles/list_spec.rb:160:46: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
          expect(find('input.datetimepicker',
                                             ^
spec/system/admin/order_cycles/list_spec.rb:188:46: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
          expect(find('input.datetimepicker',
                                             ^
spec/system/admin/order_cycles/simple_spec.rb:447:43: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
        expect(page).not_to have_selector(
                                          ^
spec/system/admin/order_spec.rb:92:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/system/admin/order_spec.rb:207:30: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
          within(".modal") do
                             ^
spec/system/admin/order_spec.rb:235:21: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
      login_as_admin
                    ^^
spec/system/admin/order_spec.rb:240:16: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
      before do
               ^
spec/system/admin/order_spec.rb:247:62: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
    context "when using the cancel option in the dropdown" do
                                                             ^^
spec/system/admin/order_spec.rb:248:16: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
      before do
               ^
spec/system/admin/order_spec.rb:299:53: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
        expect(page).to have_content "Are you sure?"
                                                    ^^^^^^^^
spec/system/admin/order_spec.rb:327:36: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
        find("a.delete-item").click
                                   ^
spec/system/admin/order_spec.rb:401:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/system/admin/order_spec.rb:405:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/system/admin/order_spec.rb:598:59: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
          expect(page).to have_link "Resend Confirmation",
                                                          ^
spec/system/admin/order_spec.rb:617:52: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
          expect(page).to have_link "Cancel Order",
                                                   ^
spec/system/admin/order_spec.rb:633:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/system/admin/order_spec.rb:635:1: C: [Corrected] Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body beginning.
spec/system/admin/order_spec.rb:635:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/system/admin/order_spec.rb:674:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/system/admin/order_spec.rb:735:35: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
          within "#order-total" do
                                  ^
spec/system/admin/order_spec.rb:762:39: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
              within "#order-total" do
                                      ^
spec/system/admin/order_spec.rb:778:41: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
                within "#order-total" do
                                        ^
spec/system/admin/order_spec.rb:780:20: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
                end
                   ^^
spec/system/admin/order_spec.rb:796:39: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
              within "#order-total" do
                                      ^
spec/system/admin/order_spec.rb:807:88: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
                # Since the order is completed, the price is not supposed to be updated
                                                                                       ^
spec/system/admin/order_spec.rb:813:41: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
                within "#order-total" do
                                        ^
spec/system/admin/order_spec.rb:815:20: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
                end
                   ^^
spec/system/admin/order_spec.rb:924:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/system/admin/order_spec.rb:959:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/system/admin/order_spec.rb:981:16: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
      before do
               ^^
spec/system/admin/order_spec.rb:992:8: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
    end
       ^^
spec/system/admin/order_spec.rb:1002:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/system/admin/shipping_methods_spec.rb:50:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/system/admin/shipping_methods_spec.rb:92:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.

1479 files inspected, 81 offenses detected, 81 offenses corrected
This commit is contained in:
Neal Chambers
2023-07-24 23:47:43 +09:00
committed by Maikel Linke
parent e0206a0be6
commit e923defd55
20 changed files with 74 additions and 101 deletions

View File

@@ -34,31 +34,6 @@ Layout/LineLength:
- 'spec/system/consumer/shopping/cart_spec.rb'
- 'spec/system/consumer/shopping/products_spec.rb'
# Offense count: 79
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowInHeredoc.
Layout/TrailingWhitespace:
Exclude:
- 'app/controllers/spree/users_controller.rb'
- 'app/controllers/user_confirmations_controller.rb'
- 'app/models/enterprise.rb'
- 'spec/controllers/spree/credit_cards_controller_spec.rb'
- 'spec/controllers/user_confirmations_controller_spec.rb'
- 'spec/factories/order_factory.rb'
- 'spec/lib/reports/packing/packing_report_spec.rb'
- 'spec/models/enterprise_spec.rb'
- 'spec/services/products_renderer_spec.rb'
- 'spec/support/request/stripe_stubs.rb'
- 'spec/system/admin/bulk_order_management_spec.rb'
- 'spec/system/admin/customers_spec.rb'
- 'spec/system/admin/enterprise_fees_spec.rb'
- 'spec/system/admin/flatpickr_spec.rb'
- 'spec/system/admin/order_cycles/complex_editing_spec.rb'
- 'spec/system/admin/order_cycles/list_spec.rb'
- 'spec/system/admin/order_cycles/simple_spec.rb'
- 'spec/system/admin/order_spec.rb'
- 'spec/system/admin/shipping_methods_spec.rb'
# Offense count: 7
# This cop supports safe autocorrection (--autocorrect).
Lint/AmbiguousOperatorPrecedence:

View File

@@ -33,7 +33,7 @@ module Spree
render status: :ok, cable_ready: cable_car.
inner_html(
"#login-feedback",
partial("layouts/alert",
partial("layouts/alert",
locals: { type: "alert", message: t('devise.failure.already_registered') })
).
dispatch_event(name: "login:modal:open")
@@ -48,7 +48,7 @@ module Spree
if @user.save
render cable_ready: cable_car.inner_html(
"#signup-feedback",
partial("layouts/alert",
partial("layouts/alert",
locals: { type: "success",
message: t('devise.user_registrations.spree_user.signed_up_but_unconfirmed') })
)

View File

@@ -24,7 +24,7 @@ class UserConfirmationsController < DeviseController
else
render cable_ready: cable_car.inner_html(
"##{params[:tab] || 'forgot'}-feedback",
partial("layouts/alert",
partial("layouts/alert",
locals: { type: "success", message: t("devise.confirmations.send_instructions") })
)
return

View File

@@ -114,7 +114,7 @@ class Enterprise < ApplicationRecord
validate :shopfront_taxons
validate :shopfront_producers
validate :enforce_ownership_limit, if: lambda { owner_id_changed? && !owner_id.nil? }
validates :instagram,
validates :instagram,
format: {
with: VALID_INSTAGRAM_REGEX,
message: Spree.t('errors.messages.invalid_instagram_url')

View File

@@ -247,7 +247,7 @@ describe Spree::CreditCardsController, type: :controller do
context "when has any other saved cards" do
let!(:second_card) {
create(:stored_credit_card, user_id: user.id,
create(:stored_credit_card, user_id: user.id,
gateway_customer_profile_id: 'cus_AZNMJ')
}

View File

@@ -42,7 +42,7 @@ describe UserConfirmationsController, type: :controller do
end
it "redirects to previous url on /register path" do
session[:confirmation_return_url] =
session[:confirmation_return_url] =
registration_path(anchor: "#/signup", after_login: "/register")
spree_get :show, confirmation_token: unconfirmed_user.confirmation_token
expect(response).

View File

@@ -37,7 +37,7 @@ FactoryBot.define do
end
after(:create) do |order, evaluator|
order.payments << build(:payment, amount: order.total,
order.payments << build(:payment, amount: order.total,
payment_method: evaluator.payment_method)
order.next!
end

View File

@@ -56,11 +56,11 @@ describe "Packing Reports" do
ship_address: create(:address))
}
let(:line_item2) {
build(:line_item_with_shipment,
build(:line_item_with_shipment,
product: create(:simple_product, name: "visible", supplier: supplier1))
}
let(:line_item3) {
build(:line_item_with_shipment,
build(:line_item_with_shipment,
product: create(:simple_product, name: "not visible", supplier: supplier2))
}

View File

@@ -518,7 +518,7 @@ describe Enterprise do
p1 = create(:simple_product, supplier: s1)
p2 = create(:simple_product, supplier: s2)
expect(Enterprise.supplying_variant_in([p1.variants.first,
expect(Enterprise.supplying_variant_in([p1.variants.first,
p2.variants.first])).to match_array [s1, s2]
end
@@ -903,7 +903,7 @@ describe Enterprise do
sender = create(:supplier_enterprise)
distributor = create(:distributor_enterprise, is_primary_producer: false)
permission = EnterpriseRelationshipPermission.create(name: "add_to_order_cycle")
create(:enterprise_relationship, parent: distributor, child: supplier,
create(:enterprise_relationship, parent: distributor, child: supplier,
permissions: [permission])
product = create(:product)
order_cycle = create(

View File

@@ -19,7 +19,7 @@ describe ProductsRenderer do
supplier_id: fruits_supplier.id)
}
let!(:product_banana_bread) {
create(:product, name: "banana bread", primary_taxon_id: cakes.id,
create(:product, name: "banana bread", primary_taxon_id: cakes.id,
supplier_id: cakes_supplier.id)
}
let!(:product_cherries) {
@@ -85,18 +85,18 @@ describe ProductsRenderer do
}
it "filters products with a product property" do
product_apples.product_properties.create!({ property_id: property_organic.id,
product_apples.product_properties.create!({ property_id: property_organic.id,
value: '1', position: 1 })
products_renderer = ProductsRenderer.new(distributor, order_cycle, customer,
products_renderer = ProductsRenderer.new(distributor, order_cycle, customer,
{ q: { with_properties: [property_organic.id] } })
products = products_renderer.send(:products)
expect(products).to eq([product_apples])
end
it "filters products with a producer property" do
fruits_supplier.producer_properties.create!({ property_id: property_organic.id,
fruits_supplier.producer_properties.create!({ property_id: property_organic.id,
value: '1', position: 1 })
products_renderer = ProductsRenderer.new(distributor, order_cycle, customer,
products_renderer = ProductsRenderer.new(distributor, order_cycle, customer,
{ q: { with_properties: [property_organic.id] } })
products = products_renderer.send(:products)
expect(products).to eq([product_apples, product_cherries])
@@ -106,15 +106,15 @@ describe ProductsRenderer do
allow(distributor).to receive(:preferred_shopfront_taxon_order) {
"#{fruits.id},#{cakes.id}"
}
product_apples.product_properties.create!({ property_id: property_conventional.id,
product_apples.product_properties.create!({ property_id: property_conventional.id,
value: '1', position: 1 })
product_banana_bread.product_properties.create!({ property_id: property_organic.id,
product_banana_bread.product_properties.create!({ property_id: property_organic.id,
value: '1', position: 1 })
product_cherries.product_properties.create!({ property_id: property_organic.id,
product_cherries.product_properties.create!({ property_id: property_organic.id,
value: '1', position: 1 })
product_doughnuts.product_properties.create!({ property_id: property_organic.id,
product_doughnuts.product_properties.create!({ property_id: property_organic.id,
value: '1', position: 1 })
products_renderer = ProductsRenderer.new(distributor, order_cycle, customer,
products_renderer = ProductsRenderer.new(distributor, order_cycle, customer,
{ q: { with_properties: [property_organic.id] } })
products = products_renderer.send(:products)
expect(products).to eq([product_cherries, product_banana_bread, product_doughnuts])

View File

@@ -14,7 +14,7 @@ module StripeStubs
.to_return(payment_intent_redirect_response_mock(redirect_url))
end
def stub_payment_intent_get_request(response: {}, stripe_account_header: true,
def stub_payment_intent_get_request(response: {}, stripe_account_header: true,
payment_intent_id: "pi_123")
stub = stub_request(:get, "https://api.stripe.com/v1/payment_intents/#{payment_intent_id}")
stub = stub.with(headers: { 'Stripe-Account' => 'abc123' }) if stripe_account_header
@@ -169,11 +169,11 @@ module StripeStubs
def get_customer_payment_methods_response_mock(options)
payment_method = options[:payment_method] || "pm_456"
fingerprint = options[:fingerprint] || "7890"
{
{
status: options[:code] || 200,
body: JSON.generate(
object: "list",
has_more: false,
object: "list",
has_more: false,
data: [{ id: payment_method, card: { fingerprint: fingerprint } }],
),
}

View File

@@ -789,7 +789,7 @@ describe '
expect(page).to have_selector "tr#li_#{li4.id}"
end
it "displays only line items whose orders meet the date restriction criteria, when changed",
it "displays only line items whose orders meet the date restriction criteria, when changed",
retry: 3 do
from = today - 8.days
to = today + 1.day
@@ -1068,7 +1068,7 @@ describe '
expect(o2.reload.state).to eq("canceled")
end.to have_enqueued_mail(Spree::OrderMailer, :cancel_email)
end
it "the user can confirm + uncheck the restock option: line item is then deleted and order is canceled without retocking" do
expect_any_instance_of(Spree::StockLocation).to_not receive(:restock)
expect do
@@ -1118,7 +1118,7 @@ describe '
end
end
shared_examples "display only group by information for selected variant" do
shared_examples "display only group by information for selected variant" do
it "displays group buy calc box" do
expect(page).to have_selector "div#group_buy_calculation"
@@ -1140,7 +1140,7 @@ describe '
end
end
end
it "all line items of the same variant" do
expect(page).to have_no_selector "tr#li_#{li1.id}"
expect(page).to have_no_selector "tr#li_#{li2.id}"
@@ -1163,7 +1163,7 @@ describe '
expect(page).to have_selector "tr#li_#{li2.id}"
expect(page).to have_selector "tr#li_#{li3.id}"
expect(page).to have_selector "tr#li_#{li4.id}"
end
end
end
context "when filtering" do

View File

@@ -15,7 +15,7 @@ describe 'Customers' do
describe "using the customers index" do
let!(:customer1) {
create(:customer, first_name: 'John', last_name: 'Doe', enterprise: managed_distributor1,
create(:customer, first_name: 'John', last_name: 'Doe', enterprise: managed_distributor1,
code: nil, created_manually: true)
}
let!(:customer2) {

View File

@@ -147,11 +147,10 @@ describe '
end
it "does not allow editing to an invalid combination" do
# starting with a valid tax category / calculator combination
expect(page).to have_select "#{prefix}_tax_category_id", selected: 'Inherit From Product'
expect(page).to have_selector "option[selected]", text: 'Flat Percent (per item)'
# editing to an invalid combination
select 'Flat Rate (per order)', from: "#{prefix}_calculator_type"
expect{ click_button 'Update' }.to_not change { fee.reload.calculator_type }
@@ -178,7 +177,7 @@ describe '
fill_in "#{prefix1}_calculator_attributes_preferred_amount", with: 1.5
click_button 'Update'
end
it "handles updating two enterprise fees" do
# Then I should see the updated fields for my fees
expect(page).to have_select "#{prefix}_fee_type", selected: 'Fundraising fee'
@@ -273,7 +272,7 @@ describe '
expect(page).
not_to have_select 'sets_enterprise_fee_set_collection_attributes_1_enterprise_id',
selected: 'Second Distributor'
# A new enterprise fee is created
expect(EnterpriseFee.count).to eq(fee_count)
end

View File

@@ -19,26 +19,26 @@ describe "Test Flatpickr" do
# Should no more have opened flatpickr
expect(page).not_to have_selector '.flatpickr-calendar.open'
end
it "opens the datepicker and closes it by clicking outside" do
login_as_admin
visit 'admin/orders'
open_datepicker('.datepicker')
find("#admin-menu").click
find("#admin-menu").click
# Should no more have opened flatpickr
expect(page).not_to have_selector '.flatpickr-calendar.open'
end
end
private
def open_datepicker(field)
# Opens a datepicker
find(field).click
# Should have opened flatpickr
expect(page).to have_selector '.flatpickr-calendar.open'
end
def check_fielddate(field, date)
# Check the value is correct
expect(find(field, match: :first).value).to eq date.to_datetime.strftime("%Y-%m-%d")

View File

@@ -71,7 +71,7 @@ describe '
'order_cycle_incoming_exchange_1_enterprise_fees_0_enterprise_id',
selected: supplier.name
)
expect(page).to have_select(
expect(page).to have_select(
'order_cycle_incoming_exchange_1_enterprise_fees_0_enterprise_fee_id',
selected: supplier.enterprise_fees.first.name
)
@@ -107,7 +107,7 @@ describe '
'order_cycle_outgoing_exchange_0_enterprise_fees_0_enterprise_id',
selected: distributor.name
)
expect(page).to have_select(
expect(page).to have_select(
'order_cycle_outgoing_exchange_0_enterprise_fees_0_enterprise_fee_id',
selected: distributor.enterprise_fees.first.name
)

View File

@@ -144,7 +144,7 @@ describe '
visit admin_order_cycles_path
within("tr.order-cycle-#{oc_pt.id}") do
expect(find('input.datetimepicker',
expect(find('input.datetimepicker',
match: :first).value).to start_with oc_open_at.strftime("%Y-%m-%d %H:%M")
find('input.datetimepicker', match: :first).click
end
@@ -157,7 +157,7 @@ describe '
end
within("tr.order-cycle-#{oc_pt.id}") do
expect(find('input.datetimepicker',
expect(find('input.datetimepicker',
match: :first).value).to eq oc_open_at.strftime("%Y-%m-13 %H:%M")
end
end
@@ -185,7 +185,7 @@ describe '
# Check the value is correct
within("tr.order-cycle-#{oc_pt.id}") do
expect(find('input.datetimepicker',
expect(find('input.datetimepicker',
match: :first).value).to eq test_value.to_datetime.strftime("%Y-%m-%d %H:%M")
end
end

View File

@@ -444,7 +444,7 @@ describe '
expect(page).to have_checked_field("order_cycle_outgoing_exchange_0_variants_#{v2.id}",
disabled: true)
expect(page).not_to have_selector(
expect(page).not_to have_selector(
"table.exchanges tr.distributor-#{distributor_managed.id} td.tags"
)

View File

@@ -89,7 +89,7 @@ describe '
visit spree.admin_orders_path
click_link 'New Order'
end
it 'shows error when distributor is not selected' do
click_button 'Next'
@@ -204,7 +204,7 @@ describe '
it "and then the order is cancelled and email is not sent when unchecked" do
expect_any_instance_of(Spree::StockLocation).to receive(:restock).at_least(1).times
expect do
within(".modal") do
within(".modal") do
uncheck("send_cancellation_email")
click_on("OK")
end
@@ -232,20 +232,20 @@ describe '
before do
order.line_items << line_item
login_as_admin
login_as_admin
visit spree.edit_admin_order_path(order)
end
context "when using the cancel button" do
before do
before do
find("#cancel_order_form").click
end
it_should_behave_like "Cancelling the order"
end
context "when using the cancel option in the dropdown" do
before do
context "when using the cancel option in the dropdown" do
before do
find("#links-dropdown .ofn-drop-down").click
find('a[href$="cancel"]').click
end
@@ -296,7 +296,7 @@ describe '
login_as_admin
visit spree.edit_admin_order_path(order)
find("a.delete-item").click
expect(page).to have_content "Are you sure?"
expect(page).to have_content "Are you sure?"
end
it "show a modal 'Are you sure?' that the user can close and then nothing change" do
@@ -324,7 +324,7 @@ describe '
order.line_items = [order.line_items.first]
login_as_admin
visit spree.edit_admin_order_path(order)
find("a.delete-item").click
find("a.delete-item").click
end
it_should_behave_like "Cancelling the order"
@@ -398,11 +398,11 @@ describe '
it "creates order and shipment successfully and allows proceeding to payment" do
fill_in "order_email", with: "test@test.com"
expect(page).to have_selector('#order_ship_address_attributes_firstname')
check "order_use_billing"
expect(page).not_to have_selector('#order_ship_address_attributes_firstname')
fill_in "order_bill_address_attributes_firstname", with: "Clark"
fill_in "order_bill_address_attributes_lastname", with: "Kent"
fill_in "order_bill_address_attributes_address1", with: "Smallville"
@@ -595,7 +595,7 @@ describe '
end
it "shows the link" do
expect(page).to have_link "Resend Confirmation",
expect(page).to have_link "Resend Confirmation",
href: spree.resend_admin_order_path(order)
end
@@ -614,7 +614,7 @@ describe '
end
it "shows the link" do
expect(page).to have_link "Cancel Order",
expect(page).to have_link "Cancel Order",
href: spree.fire_admin_order_path(order, e: 'cancel')
end
@@ -630,9 +630,8 @@ describe '
end
end
end
context "Check send/print invoice links" do
shared_examples_for 'can send/print invoices' do
before do
visit spree.edit_admin_order_path(order)
@@ -671,7 +670,7 @@ describe '
before do
distributor1.update_attribute(:abn, '12345678')
end
it_should_behave_like 'can send/print invoices'
end
@@ -732,7 +731,7 @@ describe '
"Shipping: #{different_shipping_method_for_distributor1.name}"
)
within "#order-total" do
within "#order-total" do
expect(page).to have_content "$175.00"
end
end
@@ -759,7 +758,7 @@ describe '
"Shipping: #{different_shipping_method_for_distributor1.name} $15.00"
)
within "#order-total" do
within "#order-total" do
expect(page).to have_content "$160.00"
end
end
@@ -775,9 +774,9 @@ describe '
"Shipping: #{different_shipping_method_for_distributor1.name} $15.00"
)
within "#order-total" do
within "#order-total" do
expect(page).to have_content "$160.00"
end
end
end
end
end
@@ -793,7 +792,7 @@ describe '
"Shipping: #{different_shipping_method_for_distributor1.name} $15.00"
)
within "#order-total" do
within "#order-total" do
expect(page).to have_content "$160.00"
end
end
@@ -804,15 +803,15 @@ describe '
end
it "should not update the shipping cost" do
# Since the order is completed, the price is not supposed to be updated
# Since the order is completed, the price is not supposed to be updated
visit spree.edit_admin_order_path(order)
expect(page).to have_content(
"Shipping: #{different_shipping_method_for_distributor1.name} $15.00"
)
within "#order-total" do
within "#order-total" do
expect(page).to have_content "$160.00"
end
end
end
end
end
@@ -921,7 +920,7 @@ describe '
end
expect(page).to_not have_content incomplete_order.products.first.name
end
# updates the order and verifies the warning disappears
click_button 'Update And Recalculate Fees'
expect(page).to_not have_content "Out of Stock".upcase
@@ -956,7 +955,7 @@ describe '
expect(o.order_cycle).to eq order_cycle1
end
end
describe "searching customers" do
def serching_for_customers
# opens the customer dropdown
@@ -978,7 +977,7 @@ describe '
end
context "as the enterprise owner" do
before do
before do
product.variants.first.update(on_demand: false, on_hand: 0)
login_as user
@@ -989,7 +988,7 @@ describe '
it "finds a customer by name" do
serching_for_customers
end
end
end
context "as superadmin" do
before do
@@ -999,7 +998,7 @@ describe '
new_order_with_distribution(distributor, order_cycle)
expect(page).to have_selector 'h1', text: "Customer Details"
end
it "finds a customer by name" do
serching_for_customers
end

View File

@@ -47,7 +47,7 @@ describe 'shipping methods' do
it "deleting a shipping method" do
visit spree.admin_shipping_methods_path
accept_alert 'Are you sure?' do
page.find('a.delete-resource').click
end
@@ -89,7 +89,7 @@ describe 'shipping methods' do
select2_select 'None', from: 'calc_type'
click_button 'Update'
expect(@shipping_method.reload.calculator_type).to eq "Calculator::None"
end
end