screenshot_machine 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,6 +12,7 @@ module ScreenshotMachine
12
12
  class InvalidUrl < StandardError; end
13
13
  class InvalidKey < StandardError; end
14
14
  class NoCredits < StandardError; end
15
+ class SystemError < StandardError; end
15
16
  end
16
17
 
17
18
  class << self
@@ -22,6 +22,8 @@ module ScreenshotMachine
22
22
  raise Exceptions::InvalidKey, "ERROR: Invalid API KEY"
23
23
  when "no_credits"
24
24
  raise Exceptions::NoCredits, "ERROR: No Credits for API"
25
+ when "system_error"
26
+ raise Exceptions::SystemError, "ERROR: API System Error"
25
27
  end
26
28
  response.read
27
29
  end
@@ -1,3 +1,3 @@
1
1
  module ScreenshotMachine
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -90,5 +90,16 @@ describe ScreenshotMachine::Generator do
90
90
  expect{ generator.screenshot }.to raise_error(ScreenshotMachine::Exceptions::NoCredits)
91
91
  end
92
92
  end
93
+
94
+ context "when screenshotmachine returns a system_error" do
95
+ it "should raise an exception" do
96
+ stub_request(:get, /api\.screenshotmachine\.com.*/).
97
+ to_return(
98
+ :status => 200,
99
+ :headers => { 'x-screenshotmachine-response' => 'system_error' }
100
+ )
101
+ expect{ generator.screenshot }.to raise_error(ScreenshotMachine::Exceptions::SystemError)
102
+ end
103
+ end
93
104
  end
94
105
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: screenshot_machine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-06 00:00:00.000000000 Z
12
+ date: 2013-03-07 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Screenshot Machine Gem
15
15
  email: