Permalink
Browse files

Added specs for the exception manager

  • Loading branch information...
bastien committed Feb 20, 2012
1 parent ff5cde7 commit b918eb41df49ec10f4342b5ddf490adccb3c650b
Showing with 18 additions and 0 deletions.
  1. +18 −0 spec/issuu/issuu_exception_manager_spec.rb
@@ -0,0 +1,18 @@
+require 'spec_helper'
+
+describe Issuu::IssuuExceptionManager do
+
+ describe "Invalid field exception" do
+ it "should raise an exception with the invalid field" do
+ manager = Issuu::IssuuExceptionManager.new({'code'=>'201', 'message' => 'Invalid field format', 'field' => 'apiKey'})
+ expect {manager.raise_error}.should raise_error(Issuu::IssuuException, '#201 Invalid field format: \'apiKey\'')
+ end
+ end
+
+ describe "Authentication exception" do
+ it "should raise an exception with the invalid field" do
+ manager = Issuu::IssuuExceptionManager.new({'code'=>'009', 'message' => 'Authentication required'})
+ expect {manager.raise_error}.should raise_error(Issuu::IssuuException, '#009 Authentication required')
+ end
+ end
+end

0 comments on commit b918eb4

Please sign in to comment.