Sha256: 1c1f529411adbd8a606c88c2acd9cb1d3e15b3ffddacee6c38b278e692e10fa2

Contents?: true

Size: 910 Bytes

Versions: 13

Compression:

Stored size: 910 Bytes

Contents

require 'spec_helper'

describe IEX::Resources::Sectors do
  include_context 'client'

  context 'known symbol' do
    context 'with defaults', vcr: { cassette_name: 'sectors/sectors-performance' } do
      subject do
        client.sectors('market')
      end
      let(:Sectors) { subject.first }
      it 'retrieves Sectors' do
        expect(subject.size).to eq 11
        expect(subject.first.type).to eq('sector')
        expect(subject.first.name).to eq 'Materials'
        expect(subject.first.performance).to eq 0.01013
        expect(subject.first.last_updated).to eq 1_554_408_000_270
      end
    end
  end
  context 'invalid symbol', vcr: { cassette_name: 'sectors/invalid' } do
    subject do
      client.sectors('INVALID')
    end
    it 'fails with SymbolNotFoundError' do
      expect { subject }.to raise_error IEX::Errors::SymbolNotFoundError, 'Symbol INVALID Not Found'
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
iex-ruby-client-2.1.0 spec/iex/endpoints/sectors_spec.rb
iex-ruby-client-2.0.0 spec/iex/endpoints/sectors_spec.rb
iex-ruby-client-1.6.0 spec/iex/endpoints/sectors_spec.rb
iex-ruby-client-1.5.0 spec/iex/endpoints/sectors_spec.rb
iex-ruby-client-1.4.1 spec/iex/endpoints/sectors_spec.rb
iex-ruby-client-1.4.0 spec/iex/endpoints/sectors_spec.rb
iex-ruby-client-1.3.0 spec/iex/endpoints/sectors_spec.rb
iex-ruby-client-1.2.0 spec/iex/endpoints/sectors_spec.rb
iex-ruby-client-1.1.2 spec/iex/endpoints/sectors_spec.rb
iex-ruby-client-1.1.1 spec/iex/endpoints/sectors_spec.rb
iex-ruby-client-1.1.0 spec/iex/endpoints/sectors_spec.rb
iex-ruby-client-1.0.1 spec/iex/endpoints/sectors_spec.rb
iex-ruby-client-1.0.0 spec/iex/endpoints/sectors_spec.rb