Sha256: c6df5b83e3c239567b079c26ae958d86db3358cb1aaaac7fd70ad31df55a8c58

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

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

  context 'known symbol', vcr: { cassette_name: 'company/msft' } do
    subject do
      client.company('MSFT')
    end
    it 'retrieves company information' do
      expect(subject.symbol).to eq 'MSFT'
      expect(subject.ceo).to eq 'Satya Nadella'
      expect(subject.company_name).to eq 'Microsoft Corp.'
      expect(subject.description).to include 'Develops, manufactures and distributes software products'
      expect(subject.exchange).to eq 'NASDAQ'
      expect(subject.industry).to eq 'Packaged Software'
      expect(subject.issue_type).to eq 'cs'
      expect(subject.website).to eq 'http://www.microsoft.com'
      expect(subject.sector).to eq 'Technology Services'
      expect(subject.employees).to eq 131_000
      expect(subject.security_name).to eq 'Microsoft Corporation'
    end
  end
  context 'invalid symbol', vcr: { cassette_name: 'company/invalid' } do
    subject do
      client.company('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

2 entries across 2 versions & 1 rubygems

Version Path
iex-ruby-client-1.0.1 spec/iex/endpoints/company_spec.rb
iex-ruby-client-1.0.0 spec/iex/endpoints/company_spec.rb