Skip to content
This repository
Browse code

More specific exception tests

  • Loading branch information...
commit fd6555f511d0990baa5548b0092c34f1e0bc8f84 1 parent c98ea02
Tyler Cunnion authored

Showing 2 changed files with 6 additions and 2 deletions. Show diff stats Hide diff stats

  1. +1 1  lib/crunchbase/api.rb
  2. +5 1 spec/crunchbase/api_spec.rb
2  lib/crunchbase/api.rb
@@ -24,7 +24,7 @@ class API
24 24 class << self; attr_accessor :timeout_limit, :redirect_limit end
25 25
26 26 def self.single_entity(permalink, entity_name)
27   - raise CrunchException unless SUPPORTED_ENTITIES.include?(entity_name)
  27 + raise CrunchException, "Unsupported Entity Type" unless SUPPORTED_ENTITIES.include?(entity_name)
28 28 fetch(permalink, entity_name)
29 29 end
30 30
6 spec/crunchbase/api_spec.rb
@@ -15,7 +15,11 @@ module Crunchbase
15 15 end
16 16
17 17 it "should raise exception on unfound person" do
18   - expect { API.single_entity("not-real", "person") }.to raise_error
  18 + expect { API.single_entity("not-real", "person") }.to raise_error, "Sorry, we could not find the record you were looking for."
  19 + end
  20 +
  21 + it "should raise exception for incorrect entity name" do
  22 + expect { API.single_entity("whatever", "wrong") }.to raise_error, "Unsupported Entity Type"
19 23 end
20 24
21 25 it "should follow redirects" do

0 comments on commit fd6555f

Please sign in to comment.
Something went wrong with that request. Please try again.