Fixing broken BMC specs

This commit is contained in:
Rob Harrington
2015-11-19 15:01:49 +11:00
parent 0370723edd
commit f49722ba90
4 changed files with 11 additions and 11 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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