Skip to content

Commit

Permalink
Fix long lines in new spec
Browse files Browse the repository at this point in the history
  • Loading branch information
luisramos0 committed Jun 23, 2020
1 parent 4afdb27 commit 1da1a39
Showing 1 changed file with 54 additions and 17 deletions.
71 changes: 54 additions & 17 deletions spec/services/order_tax_adjustments_fetcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,57 @@

describe OrderTaxAdjustmentsFetcher do
describe "#totals" do
let(:zone) { create(:zone_with_member) }
let(:coordinator) { create(:distributor_enterprise, charges_sales_tax: true) }
let(:zone) { create(:zone_with_member) }
let(:coordinator) { create(:distributor_enterprise, charges_sales_tax: true) }

let(:tax_rate10) { create(:tax_rate, included_in_price: true, calculator: Calculator::DefaultTax.new, amount: 0.1, zone: zone) }
let(:tax_rate15) { create(:tax_rate, included_in_price: true, calculator: Calculator::DefaultTax.new, amount: 0.15, zone: zone) }
let(:tax_rate20) { create(:tax_rate, included_in_price: true, calculator: Calculator::DefaultTax.new, amount: 0.2, zone: zone) }
let(:tax_rate25) { create(:tax_rate, included_in_price: true, calculator: Calculator::DefaultTax.new, amount: 0.25, zone: zone) }
let(:tax_category10) { create(:tax_category, tax_rates: [tax_rate10]) }
let(:tax_category15) { create(:tax_category, tax_rates: [tax_rate15]) }
let(:tax_category20) { create(:tax_category, tax_rates: [tax_rate20]) }
let(:tax_category25) { create(:tax_category, tax_rates: [tax_rate25]) }
let(:tax_rate10) do
create(:tax_rate, included_in_price: true,
calculator: Calculator::DefaultTax.new,
amount: 0.1,
zone: zone)
end
let(:tax_rate15) do
create(:tax_rate, included_in_price: true,
calculator: Calculator::DefaultTax.new,
amount: 0.15,
zone: zone)
end
let(:tax_rate20) do
create(:tax_rate, included_in_price: true,
calculator: Calculator::DefaultTax.new,
amount: 0.2,
zone: zone)
end
let(:tax_rate25) do
create(:tax_rate, included_in_price: true,
calculator: Calculator::DefaultTax.new,
amount: 0.25,
zone: zone)
end
let(:tax_category10) { create(:tax_category, tax_rates: [tax_rate10]) }
let(:tax_category15) { create(:tax_category, tax_rates: [tax_rate15]) }
let(:tax_category20) { create(:tax_category, tax_rates: [tax_rate20]) }
let(:tax_category25) { create(:tax_category, tax_rates: [tax_rate25]) }

let(:variant) { create(:variant, product: create(:product, tax_category: tax_category10)) }
let(:enterprise_fee) { create(:enterprise_fee, enterprise: coordinator, tax_category: tax_category20, calculator: Calculator::FlatRate.new(preferred_amount: 48.0)) }
let(:additional_adjustment) { create(:adjustment, amount: 50.0, included_tax: tax_rate25.compute_tax(50.0)) }
let(:variant) do
create(:variant, product: create(:product, tax_category: tax_category10))
end
let(:enterprise_fee) do
create(:enterprise_fee, enterprise: coordinator,
tax_category: tax_category20,
calculator: Calculator::FlatRate.new(preferred_amount: 48.0))
end
let(:additional_adjustment) do
create(:adjustment, amount: 50.0, included_tax: tax_rate25.compute_tax(50.0))
end

let(:order_cycle) { create(:simple_order_cycle, coordinator: coordinator, coordinator_fees: [enterprise_fee], distributors: [coordinator], variants: [variant]) }
let(:line_item) { create(:line_item, variant: variant, price: 44.0) }
let(:order_cycle) do
create(:simple_order_cycle, coordinator: coordinator,
coordinator_fees: [enterprise_fee],
distributors: [coordinator],
variants: [variant])
end
let(:line_item) { create(:line_item, variant: variant, price: 44.0) }
let(:order) do
create(
:order,
Expand All @@ -38,8 +71,12 @@
allow(Spree::Config).to receive(:shipping_tax_rate).and_return(tax_rate15.amount)
end

let(:shipping_method) { create(:shipping_method, calculator: Calculator::FlatRate.new(preferred_amount: 46.0)) }
let!(:shipment) { create(:shipment_with, :shipping_method, shipping_method: shipping_method, order: order) }
let(:shipping_method) do
create(:shipping_method, calculator: Calculator::FlatRate.new(preferred_amount: 46.0))
end
let!(:shipment) do
create(:shipment_with, :shipping_method, shipping_method: shipping_method, order: order)
end

before do
order.create_tax_charge!
Expand Down

0 comments on commit 1da1a39

Please sign in to comment.