rex/spec/book/trade_tracker_spec.rb

25 lines
490 B
Ruby
Raw Normal View History

2024-02-03 21:04:09 +01:00
# frozen_string_literal: true
RSpec.describe Rex::Book::TradeTracker do
let(:n) { 1 }
subject(:instance) { described_class.new(limit: n) }
before do
instance.add(10)
instance.add(11)
end
describe "#trades" do
it "returns only the last n trades" do
expect(instance.trades).to eq([11])
end
end
describe "#fetch_trades" do
let(:n) { 3 }
it "returns only the last n trades" do
expect(instance.fetch_trades(1)).to eq([11])
end
end
end