25 lines
490 B
Ruby
25 lines
490 B
Ruby
|
# 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
|