Merge pull request #11283 from macanudo527/fix_rubocop_layout_2

Fix rubocop layout 3
This commit is contained in:
David Cook
2023-07-27 10:29:29 +10:00
committed by GitHub
28 changed files with 91 additions and 162 deletions

View File

@@ -34,67 +34,6 @@ Layout/LineLength:
- 'spec/system/consumer/shopping/cart_spec.rb'
- 'spec/system/consumer/shopping/products_spec.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Layout/MultilineBlockLayout:
Exclude:
- 'engines/order_management/app/services/order_management/subscriptions/validator.rb'
# Offense count: 6
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: symmetrical, new_line, same_line
Layout/MultilineMethodCallBraceLayout:
Exclude:
- 'spec/system/admin/orders_spec.rb'
- 'spec/system/admin/products_spec.rb'
# Offense count: 6
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: aligned, indented, indented_relative_to_receiver
Layout/MultilineMethodCallIndentation:
Exclude:
- 'spec/controllers/api/v0/orders_controller_spec.rb'
- 'spec/system/admin/order_cycles/complex_editing_spec.rb'
- 'spec/system/admin/overview_spec.rb'
- 'spec/system/admin/payment_method_spec.rb'
- 'spec/system/admin/variant_overrides_spec.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: final_newline, final_blank_line
Layout/TrailingEmptyLines:
Exclude:
- 'Rakefile'
# Offense count: 80
# 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/product_import_spec.rb'
- 'spec/system/admin/shipping_methods_spec.rb'
# Offense count: 7
# This cop supports safe autocorrection (--autocorrect).
Lint/AmbiguousOperatorPrecedence:
@@ -240,14 +179,6 @@ Lint/UselessMethodDefinition:
Exclude:
- 'app/models/spree/gateway.rb'
# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: CheckForMethodsWithNoSideEffects.
Lint/Void:
Exclude:
- 'spec/system/admin/order_cycles/complex_updating_specific_time_spec.rb'
- 'spec/system/admin/order_cycles/simple_spec.rb'
# Offense count: 26
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
Metrics/AbcSize:
@@ -1234,7 +1165,7 @@ Style/HashLikeCase:
Exclude:
- 'app/models/enterprise.rb'
# Offense count: 1783
# Offense count: 1781
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
@@ -1491,7 +1422,6 @@ Style/HashSyntax:
- 'spec/models/enterprise_relationship_spec.rb'
- 'spec/models/enterprise_spec.rb'
- 'spec/models/exchange_spec.rb'
- 'spec/models/invoice_spec.rb'
- 'spec/models/order_cycle_spec.rb'
- 'spec/models/product_import/entry_validator_spec.rb'
- 'spec/models/product_import/inventory_reset_strategy_spec.rb'

View File

@@ -7,4 +7,3 @@
require_relative 'config/application'
Openfoodnetwork::Application.load_tasks

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

@@ -97,8 +97,8 @@ module OrderManagement
end
def subscription_line_items_present?
return if subscription_line_items.any? {
|sli| sli.quantity > 0 && !sli.marked_for_destruction?
return if subscription_line_items.any? { |sli|
sli.quantity > 0 && !sli.marked_for_destruction?
}
errors.add(:subscription_line_items, :at_least_one_product)

View File

@@ -147,7 +147,7 @@ module Api
expect(json_response['orders']
.map{ |o| o[:id] }).to eq serialized_orders([order2, order3, order1, order4])
.map{ |o| o["id"] }
.map{ |o| o["id"] }
end
end

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

@@ -27,9 +27,9 @@ describe '
# Then I should see the basic settings
expect(page.find('#order_cycle_name').value).to eq(oc.name)
expect(page.find('#order_cycle_orders_open_at').value)
.to eq(oc.orders_open_at.strftime("%Y-%m-%d %H:%M"))
.to eq(oc.orders_open_at.strftime("%Y-%m-%d %H:%M"))
expect(page.find('#order_cycle_orders_close_at').value)
.to eq(oc.orders_close_at.strftime("%Y-%m-%d %H:%M"))
.to eq(oc.orders_close_at.strftime("%Y-%m-%d %H:%M"))
expect(page).to have_content "COORDINATOR #{oc.coordinator.name}"
click_button 'Next'
@@ -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

@@ -482,16 +482,16 @@ describe '
# 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"

View File

@@ -13,7 +13,7 @@ describe '
before do
@enterprise_user = create(:user)
allow_any_instance_of(Spree::Admin::OverviewController).to receive(:spree_current_user)
.and_return @enterprise_user
.and_return @enterprise_user
login_as @enterprise_user
end

View File

@@ -59,7 +59,7 @@ describe '
Stripe.api_key = "sk_test_12345"
stub_request(:get,
"https://api.stripe.com/v1/accounts/acc_connected123")
.to_return(body: JSON.generate(stripe_account_mock))
.to_return(body: JSON.generate(stripe_account_mock))
stub_request(:get,
"https://api.stripe.com/v1/accounts/acc_revoked123").to_return(status: 404)
end

View File

@@ -343,13 +343,15 @@ describe '
expected_product_properties_url =
Regexp.new(Regexp.escape(spree.admin_product_product_properties_path(
product.id, filter)))
product.id, filter
)))
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.id, filter)))
product.id, filter
)))
expect(page).to have_link('Group Buy Options',
href: expected_product_group_buy_option_url)

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

View File

@@ -211,7 +211,7 @@ describe "
# Set a user without suficient permissions
allow_any_instance_of(Spree::Admin::BaseController).to receive(:current_spree_user)
.and_return(build(:user))
.and_return(build(:user))
expect do
click_button 'Save Changes'