Skip to content

Commit

Permalink
Remove BigDecimal new for compatibility with Ruby 2.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jdsampayo committed Jun 16, 2020
1 parent 0eebb2f commit e5aa29b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/models/plutus/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def self.balance(options={})
if self.new.class == Plutus::Account
raise(NoMethodError, "undefined method 'balance'")
else
accounts_balance = BigDecimal.new('0')
accounts_balance = BigDecimal('0')
accounts = self.all
accounts.each do |account|
if account.contra
Expand Down
2 changes: 1 addition & 1 deletion app/models/plutus/amounts_extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def balance(hash={})
#
# Since this does not use the database for sumation, it may be used on non-persisted records.
def balance_for_new_record
balance = BigDecimal.new('0')
balance = BigDecimal('0')
each do |amount_record|
if amount_record.amount && !amount_record.marked_for_destruction?
balance += amount_record.amount # unless amount_record.marked_for_destruction?
Expand Down
6 changes: 3 additions & 3 deletions spec/factories/amount_factory.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
FactoryGirl.define do
factory :amount, :class => Plutus::Amount do |amount|
amount.amount BigDecimal.new('473')
amount.amount BigDecimal('473')
amount.association :entry, :factory => :entry_with_credit_and_debit
amount.association :account, :factory => :asset
end

factory :credit_amount, :class => Plutus::CreditAmount do |credit_amount|
credit_amount.amount BigDecimal.new('473')
credit_amount.amount BigDecimal('473')
credit_amount.association :entry, :factory => :entry_with_credit_and_debit
credit_amount.association :account, :factory => :revenue
end

factory :debit_amount, :class => Plutus::DebitAmount do |debit_amount|
debit_amount.amount BigDecimal.new('473')
debit_amount.amount BigDecimal('473')
debit_amount.association :entry, :factory => :entry_with_credit_and_debit
debit_amount.association :account, :factory => :asset
end
Expand Down

0 comments on commit e5aa29b

Please sign in to comment.