spec/capital-iq_spec.rb in capital-iq-0.0.11 vs spec/capital-iq_spec.rb in capital-iq-0.0.12
- old
+ new
@@ -1,5 +1,6 @@
+require 'rspec'
require 'webmock/rspec'
require 'vcr'
require 'dotenv'
require File.expand_path(File.dirname(__FILE__) + '/../lib/capital-iq.rb')
@@ -44,7 +45,13 @@
res = client.request_gdsp([ms_id, google_id], %w(IQ_COMPANY_WEBSITE IQ_COMPANY_NAME IQ_BUSINESS_DESCRIPTION))
# You can use the 'to_hash' method to retrieve all mnemonic values for a given identifier
ms_data = res[ms_id].to_hash # all mnemonics for ms_id
# Or you can retrieve all values for all identifiers
google_data = res[google_id].to_hash # all mnemonics for google_id
+ end
+ it "raises ApiError when request is invalid" do
+ VCR.use_cassette("error") do
+ client = CapitalIQ::Client.new(ENV['CAPIQ_USER'], ENV['CAPIQ_PWD'])
+ expect {client.request_gdshe("no such id", "no such mnemonic")}.to raise_error(CapitalIQ::ApiError)
+ end
end
end