Sha256: 54edfdaf8bb0455fe48448095542fd2b3603551870ed7f8c18dd0d2e2acb415e
Contents?: true
Size: 1.25 KB
Versions: 13
Compression:
Stored size: 1.25 KB
Contents
require 'spec_helper' describe IEX::Resources::Earnings do include_context 'client' context 'known symbol' do context 'with defaults', vcr: { cassette_name: 'earnings/msft' } do subject do client.earnings('MSFT') end let(:earnings) { subject.first } it 'retrieves earnings' do expect(subject.size).to eq 1 expect(earnings.actual_eps).to eq 1.1 expect(earnings.consensus_eps).to eq 1.09 expect(earnings.announce_time).to eq 'AMC' expect(earnings.number_of_estimates).to eq 29 expect(earnings.eps_surprise_dollar).to eq 0.01 expect(earnings.eps_report_date).to eq '2019-01-30' expect(earnings.fiscal_period).to eq 'Q4 2018' expect(earnings.fiscal_end_date).to eq '2018-12-31' expect(earnings.year_ago).to eq 0.96 expect(earnings.year_ago_change_percent).to eq 0.1458 expect(earnings.year_ago_change_percent_s).to eq '+14.58%' end end end context 'invalid symbol', vcr: { cassette_name: 'earnings/invalid' } do subject do client.earnings('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