Add Order#filled? method
This commit is contained in:
parent
f2f051c3a4
commit
e92a3b1102
@ -25,5 +25,8 @@ module Rex
|
|||||||
@next_order = nil
|
@next_order = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def filled?
|
||||||
|
remaining_amount == 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
27
spec/order_spec.rb
Normal file
27
spec/order_spec.rb
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
RSpec.describe Rex::Order do
|
||||||
|
describe "#filled?" do
|
||||||
|
let(:order) do
|
||||||
|
instance = described_class.new(
|
||||||
|
amount: 100
|
||||||
|
)
|
||||||
|
instance.remaining_amount = remaining_amount
|
||||||
|
instance
|
||||||
|
end
|
||||||
|
|
||||||
|
subject { order.filled? }
|
||||||
|
|
||||||
|
context "when remaining amount is not zero" do
|
||||||
|
let(:remaining_amount) { 50 }
|
||||||
|
|
||||||
|
it { is_expected.to be(false) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when remaining amount is zero" do
|
||||||
|
let(:remaining_amount) { 0 }
|
||||||
|
|
||||||
|
it { is_expected.to be(true) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user