replace Presenter#invoice_date with a delagator

This commit is contained in:
Mohamed ABDELLANI
2023-07-14 10:41:50 +01:00
parent d044959cec
commit 5358802ab5
2 changed files with 3 additions and 6 deletions

View File

@@ -4,8 +4,8 @@ class Invoice
class DataPresenter
attr_reader :invoice
delegate :data, :date, to: :invoice
delegate :number, to: :invoice, prefix: true
delegate :data, to: :invoice
delegate :number, :date, to: :invoice, prefix: true
FINALIZED_NON_SUCCESSFUL_STATES = %w(canceled returned).freeze
@@ -83,10 +83,6 @@ class Invoice
all_eligible_adjustments.select { |a| a.originator_type == 'Spree::TaxRate' }
end
def invoice_date
date
end
def paid?
data[:payment_state] == 'paid' || data[:payment_state] == 'credit_owed'
end

View File

@@ -31,6 +31,7 @@ describe '
login_as_admin
visit spree.edit_admin_order_path(order)
end
describe 'creating invoices' do
context 'when the order has no invoices' do
it 'creates an invoice for the order' do