Sha256: 9fbe087077f555ae526257d5f92d5afb3cc19f5fe6500426c02b45f481629354

Contents?: true

Size: 722 Bytes

Versions: 5

Compression:

Stored size: 722 Bytes

Contents

require 'helper'

describe StockIndex::Component do

  it 'returns the value written to the cache' do
    component = StockIndex::Component.new('T', 'test', nil)
    component.cache_write('ZZZZ')
    expect(component.cache_lookup).to eq('ZZZZ')
  end

  it 'returns the correct attributes with a valid symbol' do
    component = StockIndex::Component.new('CSCO', 'XNAS', nil)
    expect(component.attributes_lookup).to eq({:market=>"XNAS", :symbol=>"CSCO", :name=>"CISCO SYSTEMS INC", :wikipedia=>nil, :cik=>"0000858877", :bbgid=>"BBG000C3J3C9"})
  end

  it 'returns nil with an invalid symbol' do
    component = StockIndex::Component.new('ZZZZ', 'XNAS', nil)
    expect(component.attributes_lookup).to be_nil
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
stock_index-0.8.3 spec/stock_index/component_spec.rb
stock_index-0.8.2 spec/stock_index/component_spec.rb
stock_index-0.8.1 spec/stock_index/component_spec.rb
stock_index-0.8.0 spec/stock_index/component_spec.rb
stock_index-0.7.0 spec/stock_index/component_spec.rb