Add tests to invoice

This commit is contained in:
Martin Lensment 2015-04-10 13:19:54 +03:00
parent 416842f924
commit 7eff257434
7 changed files with 119 additions and 26 deletions

View file

@ -4,6 +4,8 @@ class Invoice < ActiveRecord::Base
has_many :invoice_items
accepts_nested_attributes_for :invoice_items
validates :invoice_type, :due_date, :currency, :seller_name, :seller_iban, :buyer_name, :invoice_items, :vat_prc, presence: true
def seller_address
[seller_street, seller_city, seller_state, seller_zip].reject(&:blank?).compact.join(', ')
end