Skip to content

Commit

Permalink
Fix Style/HashSyntax
Browse files Browse the repository at this point in the history
  • Loading branch information
macanudo527 committed Sep 28, 2023
1 parent dd0279c commit 57d2f04
Show file tree
Hide file tree
Showing 30 changed files with 160 additions and 160 deletions.
10 changes: 5 additions & 5 deletions spec/services/tax_rate_finder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
describe "getting the corresponding tax rate" do
let(:amount) { BigDecimal(120) }
let(:tax_rate) {
create(:tax_rate, amount: 0.2, calculator: Calculator::DefaultTax.new, zone: zone)
create(:tax_rate, amount: 0.2, calculator: Calculator::DefaultTax.new, zone:)
}
let(:tax_rate_shipping) {
create(:tax_rate, amount: 0.05, calculator: Calculator::DefaultTax.new, zone: zone)
create(:tax_rate, amount: 0.05, calculator: Calculator::DefaultTax.new, zone:)
}
let(:tax_category) { create(:tax_category, tax_rates: [tax_rate]) }
let(:tax_category_shipping) { create(:tax_category, tax_rates: [tax_rate_shipping]) }
let(:zone) { create(:zone_with_member) }
let(:shipping_method) { create(:shipping_method, tax_category: tax_category_shipping) }
let(:shipment) { create(:shipment_with, :shipping_method, shipping_method: shipping_method) }
let(:shipment) { create(:shipment_with, :shipping_method, shipping_method:) }
let(:line_item) { create(:line_item) }
let(:enterprise_fee) { create(:enterprise_fee, tax_category: tax_category) }
let(:order) { create(:order_with_taxes, zone: zone) }
let(:enterprise_fee) { create(:enterprise_fee, tax_category:) }
let(:order) { create(:order_with_taxes, zone:) }

subject { TaxRateFinder.new }

Expand Down
2 changes: 1 addition & 1 deletion spec/services/user_default_address_setter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
create(:customer, bill_address: customer_address, ship_address: customer_address)
end
let(:order) do
create(:order, customer: customer, bill_address: order_address, ship_address: order_address)
create(:order, customer:, bill_address: order_address, ship_address: order_address)
end
let(:user) { create(:user) }

Expand Down
2 changes: 1 addition & 1 deletion spec/services/variants_stock_levels_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
let(:order) { create(:order) }

let!(:line_item) do
create(:line_item, order: order, variant: variant_in_the_order, quantity: 2, max_quantity: 3)
create(:line_item, order:, variant: variant_in_the_order, quantity: 2, max_quantity: 3)
end
let!(:variant_in_the_order) { create(:variant) }
let!(:variant_not_in_the_order) { create(:variant) }
Expand Down
6 changes: 3 additions & 3 deletions spec/services/voucher_adjustments_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

context 'with a flat rate voucher' do
let(:voucher) do
create(:voucher_flat_rate, code: 'new_code', enterprise: enterprise, amount: 10)
create(:voucher_flat_rate, code: 'new_code', enterprise:, amount: 10)
end

context 'when voucher covers the order total' do
Expand Down Expand Up @@ -174,7 +174,7 @@

context 'with a percentage rate voucher' do
let(:voucher) do
create(:voucher_percentage_rate, code: 'new_code', enterprise: enterprise, amount: 10)
create(:voucher_percentage_rate, code: 'new_code', enterprise:, amount: 10)
end
let(:adjustment) { order.voucher_adjustments.first }
let(:tax_adjustment) { order.voucher_adjustments.second }
Expand All @@ -183,7 +183,7 @@
subject { order.voucher_adjustments.first }

let(:voucher) do
create(:voucher_percentage_rate, code: 'new_code', enterprise: enterprise, amount: 100)
create(:voucher_percentage_rate, code: 'new_code', enterprise:, amount: 100)
end
let(:order) { create(:order_with_totals) }

Expand Down
2 changes: 1 addition & 1 deletion spec/support/controller_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def controller_login_as_enterprise_user(enterprises)
user = create(:user)
user.spree_roles = []
enterprises.each do |enterprise|
enterprise.enterprise_roles.create!(user: user)
enterprise.enterprise_roles.create!(user:)
end
user
end
Expand Down
6 changes: 3 additions & 3 deletions spec/support/controller_requests_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ def process_json_action(action, params = {}, session = nil, flash = nil, method

def process_action_with_route(action, params = {}, session = nil, flash = nil, method = "GET")
process(action,
method: method,
method:,
params: params.reverse_merge!(use_route: :main_app),
session: session,
flash: flash)
session:,
flash:)
end
end
6 changes: 3 additions & 3 deletions spec/support/request/stripe_stubs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def stub_payment_methods_post_request(request: { payment_method: "pm_123" }, res
def stub_payment_method_attach_request(payment_method: "pm_123", customer: "cus_A123")
stub_request(:post,
"https://api.stripe.com/v1/payment_methods/#{payment_method}/attach")
.with(body: { customer: customer })
.with(body: { customer: })
.to_return(hub_payment_method_response_mock({ pm_id: payment_method }))
end

Expand All @@ -44,7 +44,7 @@ def stub_retrieve_payment_method_request(payment_method_id = "pm_1234")
# Stubs the customers call to both the main stripe account and the connected account
def stub_customers_post_request(email:, response: {}, stripe_account_header: false)
stub = stub_request(:post, "https://api.stripe.com/v1/customers")
.with(body: { email: email })
.with(body: { email: })
stub = stub.with(headers: { 'Stripe-Account' => 'abc123' }) if stripe_account_header
stub.to_return(customers_response_mock(response))
end
Expand Down Expand Up @@ -174,7 +174,7 @@ def get_customer_payment_methods_response_mock(options)
body: JSON.generate(
object: "list",
has_more: false,
data: [{ id: payment_method, card: { fingerprint: fingerprint } }],
data: [{ id: payment_method, card: { fingerprint: } }],
),
}
end
Expand Down
2 changes: 1 addition & 1 deletion spec/support/request/ui_component_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def click_reset_password_button

def select_login_tab(text)
within ".login-modal" do
page.find("a", text: text).click
page.find("a", text:).click
end
sleep 0.2
end
Expand Down
4 changes: 2 additions & 2 deletions spec/support/request/web_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ def have_input(name, opts = {})

visible = opts.key?(:visible) ? opts[:visible] : true

element = page.all(selector, visible: visible).first
element = page.all(selector, visible:).first
expect(element.value).to eq(opts[:with]) if element && opts.key?(:with)

have_selector selector, visible: visible
have_selector selector, visible:
end

def select_by_value(value, options = {})
Expand Down
14 changes: 7 additions & 7 deletions spec/system/admin/adjustments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
let!(:order_cycle) { create(:simple_order_cycle, distributors: [distributor]) }

let!(:order) {
create(:order_with_totals_and_distribution, user: user, distributor: distributor,
order_cycle: order_cycle, state: 'complete',
create(:order_with_totals_and_distribution, user:, distributor:,
order_cycle:, state: 'complete',
payment_state: 'balance_due')
}
let!(:tax_category) { create(:tax_category, name: 'GST') }
let!(:tax_rate) {
create(:tax_rate, name: 'GST', calculator: build(:calculator, preferred_amount: 10),
zone: create(:zone_with_member), tax_category: tax_category)
zone: create(:zone_with_member), tax_category:)
}

let!(:tax_category_included) { create(:tax_category, name: 'TVA 20%', is_default: true) }
Expand All @@ -33,7 +33,7 @@

before do
order.finalize!
create(:check_payment, order: order, amount: order.total)
create(:check_payment, order:, amount: order.total)
login_as_admin
visit spree.admin_orders_path
end
Expand Down Expand Up @@ -124,7 +124,7 @@
it "modifying taxed adjustments on an order" do
# Given a taxed adjustment
adjustment = create(:adjustment, label: "Extra Adjustment", adjustable: order,
amount: 110, tax_category: tax_category, order: order)
amount: 110, tax_category:, order:)

# When I go to the adjustments page for the order
page.find('td.actions a.icon-edit').click
Expand All @@ -145,7 +145,7 @@
it "modifying an untaxed adjustment on an order" do
# Given an untaxed adjustment
adjustment = create(:adjustment, label: "Extra Adjustment", adjustable: order,
amount: 110, tax_category: nil, order: order)
amount: 110, tax_category: nil, order:)

# When I go to the adjustments page for the order
page.find('td.actions a.icon-edit').click
Expand All @@ -167,7 +167,7 @@
# Given a taxed adjustment
let!(:adjustment) {
create(:adjustment, label: "Extra Adjustment", adjustable: order,
amount: 110, tax_category: tax_category, order: order)
amount: 110, tax_category:, order:)
}
before do
order.cancel!
Expand Down
6 changes: 3 additions & 3 deletions spec/system/admin/bulk_product_update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
let!(:product) { create(:product) }
let(:variant) { product.variants.first }
let(:hub) { create(:distributor_enterprise) }
let!(:override) { create(:variant_override, variant: variant, hub: hub ) }
let!(:override) { create(:variant_override, variant:, hub: ) }
let(:variant_overrides_tip) {
"This variant has %d override(s)" % 1
}
Expand Down Expand Up @@ -269,8 +269,8 @@
end

context "handle the 'on_demand' variant case creation" do
let(:v1) { create(:variant, product: product, on_hand: 4) }
let(:v2) { create(:variant, product: product, on_demand: true) }
let(:v1) { create(:variant, product:, on_hand: 4) }
let(:v2) { create(:variant, product:, on_demand: true) }

before do
product.variants << v1
Expand Down
2 changes: 1 addition & 1 deletion spec/system/admin/configuration/states_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def go_to_states_page
end

context "admin visiting states listing" do
let!(:state) { Spree::State.create(name: 'Alabama', country: country) }
let!(:state) { Spree::State.create(name: 'Alabama', country:) }

it "should correctly display the states" do
visit spree.admin_country_states_path(country)
Expand Down
2 changes: 1 addition & 1 deletion spec/system/admin/configuration/tax_rates_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
include AuthenticationHelper

let!(:calculator) { create(:calculator_per_item, calculable: create(:order)) }
let!(:tax_rate) { create(:tax_rate, name: "IVA", calculator: calculator) }
let!(:tax_rate) { create(:tax_rate, name: "IVA", calculator:) }
let!(:zone) { create(:zone, name: "Ilhas") }
let!(:tax_category) { create(:tax_category, name: "Full") }

Expand Down
4 changes: 2 additions & 2 deletions spec/system/admin/customers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
create(:stripe_sca_payment_method, distributors: [managed_distributor1])
}
let!(:payment1) {
create(:payment, :completed, order: order1, payment_method: payment_method,
create(:payment, :completed, order: order1, payment_method:,
response_code: 'pi_123', amount: 88.00)
}

Expand Down Expand Up @@ -162,7 +162,7 @@

context "with an additional negative payment (or refund)" do
let!(:payment2) {
create(:payment, :completed, order: order1, payment_method: payment_method,
create(:payment, :completed, order: order1, payment_method:,
response_code: 'pi_123', amount: -25.00)
}

Expand Down
4 changes: 2 additions & 2 deletions spec/system/admin/enterprises_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@
}

before do
distributor1.update(custom_tab: custom_tab)
distributor1.update(custom_tab:)
visit edit_admin_enterprise_path(distributor1)
within(".side_menu") do
click_link "White Label"
Expand Down Expand Up @@ -842,7 +842,7 @@

context "changing package" do
let!(:owner) { create(:user) }
let!(:enterprise) { create(:distributor_enterprise, owner: owner, is_primary_producer: true) }
let!(:enterprise) { create(:distributor_enterprise, owner:, is_primary_producer: true) }
before do
login_as owner
end
Expand Down
34 changes: 17 additions & 17 deletions spec/system/admin/invoice_print_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
end

let(:order) do
create(:order_with_totals_and_distribution, user: user, distributor: distributor,
order_cycle: order_cycle, state: 'complete',
create(:order_with_totals_and_distribution, user:, distributor:,
order_cycle:, state: 'complete',
payment_state: 'balance_due')
end

Expand Down Expand Up @@ -54,7 +54,7 @@

context "with one payment" do
let!(:payment1) do
create(:payment, :completed, order: order, payment_method: payment_method1)
create(:payment, :completed, order:, payment_method: payment_method1)
end
before do
order.save!
Expand All @@ -72,10 +72,10 @@
context "with two payments, and one that failed" do
before do
order.update payments: []
order.payments << create(:payment, :completed, order: order,
order.payments << create(:payment, :completed, order:,
payment_method: payment_method1,
created_at: 1.day.ago)
order.payments << create(:payment, order: order, state: 'failed',
order.payments << create(:payment, order:, state: 'failed',
payment_method: payment_method2, created_at: 2.days.ago)
order.save!
end
Expand All @@ -92,10 +92,10 @@
context "with two completed payments" do
before do
order.update payments: []
order.payments << create(:payment, :completed, order: order,
order.payments << create(:payment, :completed, order:,
payment_method: payment_method1,
created_at: 2.days.ago)
order.payments << create(:payment, :completed, order: order,
order.payments << create(:payment, :completed, order:,
payment_method: payment_method2,
created_at: 1.day.ago)
order.save!
Expand All @@ -113,7 +113,7 @@

shared_examples "Check display on each invoice: legacy and alternative" do |alternative_invoice|
let!(:completed_order) do
create(:completed_order_with_fees, distributor: distributor, order_cycle: order_cycle,
create(:completed_order_with_fees, distributor:, order_cycle:,
user: create(:user, email: "[email protected]"),
bill_address: create(:address, phone: '1234567890'))
end
Expand Down Expand Up @@ -141,10 +141,10 @@

context "included" do
let(:shipping_tax_rate_included) {
create(:tax_rate, amount: 0.1, included_in_price: true, zone: zone)
create(:tax_rate, amount: 0.1, included_in_price: true, zone:)
}
let(:enterprise_fee_rate_included) {
create(:tax_rate, amount: 0.15, included_in_price: true, zone: zone)
create(:tax_rate, amount: 0.15, included_in_price: true, zone:)
}
let(:shipping_tax_category) { create(:tax_category, tax_rates: [shipping_tax_rate_included]) }
let(:fee_tax_category) { create(:tax_category, tax_rates: [enterprise_fee_rate_included]) }
Expand All @@ -164,15 +164,15 @@
}

let!(:order1) {
create(:order, order_cycle: order_cycle, distributor: user1.enterprises.first,
create(:order, order_cycle:, distributor: user1.enterprises.first,
ship_address: address, bill_address: address)
}
let!(:product1) {
create(:taxed_product, zone: zone, price: 12.54, tax_rate_amount: 0,
create(:taxed_product, zone:, price: 12.54, tax_rate_amount: 0,
included_in_price: true)
}
let!(:product2) {
create(:taxed_product, zone: zone, price: 500.15, tax_rate_amount: 0.2,
create(:taxed_product, zone:, price: 500.15, tax_rate_amount: 0.2,
included_in_price: true)
}

Expand Down Expand Up @@ -275,10 +275,10 @@

context "added" do
let(:shipping_tax_rate_added) {
create(:tax_rate, amount: 0.10, included_in_price: false, zone: zone)
create(:tax_rate, amount: 0.10, included_in_price: false, zone:)
}
let(:enterprise_fee_rate_added) {
create(:tax_rate, amount: 0.15, included_in_price: false, zone: zone)
create(:tax_rate, amount: 0.15, included_in_price: false, zone:)
}
let(:shipping_tax_category) { create(:tax_category, tax_rates: [shipping_tax_rate_added]) }
let(:fee_tax_category) { create(:tax_category, tax_rates: [enterprise_fee_rate_added]) }
Expand All @@ -302,11 +302,11 @@
ship_address: address, bill_address: address)
}
let(:product3) {
create(:taxed_product, zone: zone, price: 12.54, tax_rate_amount: 0,
create(:taxed_product, zone:, price: 12.54, tax_rate_amount: 0,
included_in_price: false)
}
let(:product4) {
create(:taxed_product, zone: zone, price: 500.15, tax_rate_amount: 0.2,
create(:taxed_product, zone:, price: 500.15, tax_rate_amount: 0.2,
included_in_price: false)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
# Given coordinating, supplying and distributing enterprises with some products with variants
let!(:coordinator) { create(:distributor_enterprise, name: 'My coordinator') }
let!(:supplier) { create(:supplier_enterprise, name: 'My supplier') }
let!(:product) { create(:product, supplier: supplier) }
let!(:v1) { create(:variant, product: product) }
let!(:v2) { create(:variant, product: product) }
let!(:product) { create(:product, supplier:) }
let!(:v1) { create(:variant, product:) }
let!(:v2) { create(:variant, product:) }
let!(:distributor) {
create(:distributor_enterprise, name: 'My distributor', with_payment_and_shipping: true)
}
Expand Down
Loading

0 comments on commit 57d2f04

Please sign in to comment.