Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions 03/spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
require 'bigdecimal'
require 'bigdecimal/util'

class BigDecimal
alias :original_plus :+
alias :original_minus :-

def +(other)
if other.kind_of? String
return original_plus other.to_d
end
original_plus other
end

def -(other)
if other.kind_of? String
return original_minus other.to_d
end
original_minus other
end
end

describe Inventory do
let(:inventory) { Inventory.new }
let(:cart) { inventory.new_cart }
Expand Down