Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SerKnight committed Jan 27, 2021
1 parent 17f7bef commit 5cb3b84
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 18 deletions.
2 changes: 1 addition & 1 deletion lib/xero-ruby/models/accounting/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class Account
CISLABOURINCOME = "CISLABOURINCOME".freeze
CISLIABILITY = "CISLIABILITY".freeze
CISMATERIALS = "CISMATERIALS".freeze
EMPTY = "".freeze
# EMPTY = "".freeze

# Shown if set
attr_accessor :reporting_code
Expand Down
26 changes: 13 additions & 13 deletions lib/xero-ruby/models/accounting/organisation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class Organisation
N6_MONTHLY = "6MONTHLY".freeze
QUARTERLY = "QUARTERLY".freeze
YEARLY = "YEARLY".freeze
NONE = "NONE".freeze
# NONE = "NONE".freeze

# The default for LineAmountTypes on sales transactions
attr_accessor :default_sales_tax
Expand All @@ -135,18 +135,18 @@ class Organisation

# Organisation Entity Type
attr_accessor :organisation_entity_type
ACCOUNTING_PRACTICE = "ACCOUNTING_PRACTICE".freeze
COMPANY = "COMPANY".freeze
CHARITY = "CHARITY".freeze
CLUB_OR_SOCIETY = "CLUB_OR_SOCIETY".freeze
LOOK_THROUGH_COMPANY = "LOOK_THROUGH_COMPANY".freeze
NOT_FOR_PROFIT = "NOT_FOR_PROFIT".freeze
PARTNERSHIP = "PARTNERSHIP".freeze
S_CORPORATION = "S_CORPORATION".freeze
SELF_MANAGED_SUPERANNUATION_FUND = "SELF_MANAGED_SUPERANNUATION_FUND".freeze
SOLE_TRADER = "SOLE_TRADER".freeze
SUPERANNUATION_FUND = "SUPERANNUATION_FUND".freeze
TRUST = "TRUST".freeze
# ACCOUNTING_PRACTICE = "ACCOUNTING_PRACTICE".freeze
# COMPANY = "COMPANY".freeze
# CHARITY = "CHARITY".freeze
# CLUB_OR_SOCIETY = "CLUB_OR_SOCIETY".freeze
# LOOK_THROUGH_COMPANY = "LOOK_THROUGH_COMPANY".freeze
# NOT_FOR_PROFIT = "NOT_FOR_PROFIT".freeze
# PARTNERSHIP = "PARTNERSHIP".freeze
# S_CORPORATION = "S_CORPORATION".freeze
# SELF_MANAGED_SUPERANNUATION_FUND = "SELF_MANAGED_SUPERANNUATION_FUND".freeze
# SOLE_TRADER = "SOLE_TRADER".freeze
# SUPERANNUATION_FUND = "SUPERANNUATION_FUND".freeze
# TRUST = "TRUST".freeze

# A unique identifier for the organisation. Potential uses.
attr_accessor :short_code
Expand Down
20 changes: 16 additions & 4 deletions spec/helper_methods_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,24 @@
)
}

it 'can serialize invoice attributes into a snake_case hash' do
expect(invoice.to_hash).to eq({currency_code: "USD", has_attachments: false, has_errors: false, invoice_number: "abc-123", total_discount: 100, type: "ACCPAY"})
describe '#to_hash' do
it 'can serialize invoice attributes into a PascalCase hash' do
expect(invoice.to_hash).to eq(:CurrencyCode => "USD", :HasAttachments => false, :HasErrors => false, :InvoiceNumber => "abc-123", :TotalDiscount => 100, :Type => "ACCPAY")
end

it 'can serialize contact attributes into a PascalCase hash' do
expect(contact.to_hash).to eq(:AccountNumber => "abc-123", :ContactStatus => "ACTIVE", :EmailAddress => "[email protected]", :FirstName => "Contact", :HasAttachments => false, :HasValidationErrors => false, :LastName => "Name", :Name => "Contact Name")
end
end

it 'can serialize contact attributes into a snake_case hash' do
expect(contact.to_hash).to eq({account_number: "abc-123", contact_status: "ACTIVE", email_address: "[email protected]", first_name: 'Contact', has_attachments: false, has_validation_errors: false, last_name: "Name", name: "Contact Name"})
describe '#attributes' do
it 'can serialize invoice attributes into a snake_case hash' do
expect(invoice.attributes).to eq({currency_code: "USD", has_attachments: false, has_errors: false, invoice_number: "abc-123", total_discount: 100, type: "ACCPAY"})
end

it 'can serialize contact attributes into a snake_case hash' do
expect(contact.attributes).to eq({account_number: "abc-123", contact_status: "ACTIVE", email_address: "[email protected]", first_name: 'Contact', has_attachments: false, has_validation_errors: false, last_name: "Name", name: "Contact Name"})
end
end
end
end

0 comments on commit 5cb3b84

Please sign in to comment.