Sha256: 2b48c45531da3f43e1839dd07d8df98b0652bc25c8ca0b82f5499d8b401a343c
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
require './test/test_helper' class TestStockData < Minitest::Test def setup ticker = "TESTING" @days = 90 @total_days = @days + SignalTools::StockData::Extra_Days @from_date = Date.today - @days @to_date = Date.today YahooFinance.stub(:get_historical_quotes, data_for_tests(@days)) do @stock_data = SignalTools::StockData.new(ticker, @from_date, @to_date) end end def test_dates new_dates = [] (0...@days).each { |i| new_dates.unshift(@to_date - i) } assert_equal new_dates, @stock_data.dates end def test_open_prices result = @stock_data.open_prices.delete_if { |e| !e.is_a?(Float) } assert_equal @total_days, result.size end def test_high_prices result = @stock_data.high_prices.delete_if { |e| !e.is_a?(Float) } assert_equal @total_days, result.size end def test_low_prices result = @stock_data.low_prices.delete_if { |e| !e.is_a?(Float) } assert_equal @total_days, result.size end def test_close_prices result = @stock_data.close_prices.delete_if { |e| !e.is_a?(Float) } assert_equal @total_days, result.size end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
signal_tools-0.3.1 | test/test_stock_data.rb |