diff --git a/spec/controllers/admin/business_model_configuration_controller_spec.rb b/spec/controllers/admin/business_model_configuration_controller_spec.rb index 3418408417..b0ae86d4ac 100644 --- a/spec/controllers/admin/business_model_configuration_controller_spec.rb +++ b/spec/controllers/admin/business_model_configuration_controller_spec.rb @@ -58,7 +58,7 @@ describe Admin::BusinessModelConfigurationController, type: :controller do it "does not allow them to be set" do expect(response).to render_template :edit - expect(assigns(:settings).errors.count).to be 4 + expect(assigns(:settings).errors.count).to be 5 expect(Spree::Config.account_invoices_monthly_fixed).to eq 5 expect(Spree::Config.account_invoices_monthly_rate).to eq 0.02 expect(Spree::Config.account_invoices_monthly_cap).to eq 50 diff --git a/spec/features/admin/business_model_configuration_spec.rb b/spec/features/admin/business_model_configuration_spec.rb index 61da09293f..05d5367437 100644 --- a/spec/features/admin/business_model_configuration_spec.rb +++ b/spec/features/admin/business_model_configuration_spec.rb @@ -11,7 +11,7 @@ feature 'Business Model Configuration' do Spree::Config.set({ account_invoices_monthly_fixed: 5, account_invoices_monthly_rate: 0.02, - account_invoices_monthly_cap: 50 + account_invoices_monthly_cap: 50, account_invoices_tax_rate: 0.1 }) end @@ -45,7 +45,7 @@ feature 'Business Model Configuration' do expect(Spree::Config.account_invoices_monthly_fixed).to eq 10 expect(Spree::Config.account_invoices_monthly_rate).to eq 0.05 expect(Spree::Config.account_invoices_monthly_cap).to eq 30 - expect(Spree::Config.settings_account_invoices_tax_rate).to eq 0.15 + expect(Spree::Config.account_invoices_tax_rate).to eq 0.15 end end end diff --git a/spec/jobs/finalize_account_invoices_spec.rb b/spec/jobs/finalize_account_invoices_spec.rb index e169df93e5..552a909f3f 100644 --- a/spec/jobs/finalize_account_invoices_spec.rb +++ b/spec/jobs/finalize_account_invoices_spec.rb @@ -200,9 +200,9 @@ describe FinalizeAccountInvoices do invoice.reload expect(invoice.completed_at).to_not be_nil - expect(invoice.total).to eq billable_period1.bill + expect(invoice.total).to eq billable_period1.bill.round(2) expect(invoice.payments.count).to eq 1 - expect(invoice.payments.first.amount).to eq billable_period1.bill + expect(invoice.payments.first.amount).to eq billable_period1.bill.round(2) expect(invoice.state).to eq 'complete' end end diff --git a/spec/jobs/update_account_invoices_spec.rb b/spec/jobs/update_account_invoices_spec.rb index 42198f4ff9..fd2a490d8c 100644 --- a/spec/jobs/update_account_invoices_spec.rb +++ b/spec/jobs/update_account_invoices_spec.rb @@ -152,7 +152,7 @@ describe UpdateAccountInvoices do it "creates adjustments for each billing item" do adjustments = invoice_order.adjustments expect(adjustments.map(&:source_id)).to eq [old_billable_period.id] - expect(adjustments.map(&:amount)).to eq [old_billable_period.bill] + expect(adjustments.map(&:amount)).to eq [old_billable_period.bill.round(2)] expect(adjustments.map(&:label)).to eq [old_billable_period.adjustment_label] end @@ -189,7 +189,7 @@ describe UpdateAccountInvoices do it "creates adjustments for each billing item" do adjustments = july_account_invoice.order.adjustments expect(adjustments.map(&:source_id)).to eq [billable_period1.id, billable_period2.id] - expect(adjustments.map(&:amount)).to eq [billable_period1.bill, billable_period2.bill] + expect(adjustments.map(&:amount)).to eq [billable_period1.bill.round(2), billable_period2.bill.round(2)] expect(adjustments.map(&:label)).to eq [billable_period1.adjustment_label, billable_period2.adjustment_label] end @@ -355,8 +355,8 @@ describe UpdateAccountInvoices do expect(user.orders.first).to eq invoice_order expect(invoice_order.completed_at).to be_nil billable_adjustments = invoice_order.adjustments.where('source_type = (?)', 'BillablePeriod') - expect(billable_adjustments.map(&:amount)).to eq [billable_period2.bill, billable_period3.bill] - expect(invoice_order.total).to eq billable_period2.bill + billable_period3.bill + expect(billable_adjustments.map(&:amount)).to eq [billable_period2.bill.round(2), billable_period3.bill.round(2)] + expect(invoice_order.total).to eq (billable_period2.bill + billable_period3.bill).round(2) expect(invoice_order.payments.count).to eq 0 expect(invoice_order.state).to eq 'cart' expect(invoice_order.bill_address).to be_a Spree::Address @@ -399,8 +399,8 @@ describe UpdateAccountInvoices do expect(invoice_order.completed_at).to be_nil billable_adjustments = invoice_order.adjustments.where('source_type = (?)', 'BillablePeriod') expect(billable_adjustments).to_not include billable_adjustment - expect(billable_adjustments.map(&:amount)).to eq [billable_period2.bill, billable_period3.bill] - expect(invoice_order.total).to eq billable_period2.bill + billable_period3.bill + expect(billable_adjustments.map(&:amount)).to eq [billable_period2.bill.round(2), billable_period3.bill.round(2)] + expect(invoice_order.total).to eq (billable_period2.bill + billable_period3.bill).round(2) expect(invoice_order.payments.count).to eq 0 expect(invoice_order.state).to eq 'cart' expect(invoice_order.bill_address).to be_a Spree::Address