redness 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/redness/red.rb CHANGED
@@ -21,7 +21,7 @@ class Red
21
21
 
22
22
  def execute_with_uncertainty(fail_return = [])
23
23
  yield
24
- rescue RedisUnavailable, Redis::CannotConnectError, Errno::ECONNREFUSED, Timeout, Timeout::Error, Errno::EAGAIN
24
+ rescue RedisUnavailable, Redis::CannotConnectError, Redis::TimeoutError
25
25
  fail_return
26
26
  end
27
27
 
@@ -1,4 +1,4 @@
1
1
  module Redness
2
- VERSION="0.1.1"
2
+ VERSION="0.1.2"
3
3
  MAJOR, MINOR, TINY = VERSION.split(".")
4
4
  end
@@ -1,6 +1,20 @@
1
1
  require_relative '../spec_integration_helper'
2
2
 
3
3
  describe Red do
4
+ describe "#execute_with_uncertainty" do
5
+ it "should return the given value if the block raises a Red::RedisUnavailable" do
6
+ Red.new.execute_with_uncertainty(2) { raise Red::RedisUnavailable }.should == 2
7
+ end
8
+
9
+ it "should return the given value if the block raises a Redis::CannotConnectError" do
10
+ Red.new.execute_with_uncertainty(2) { raise Redis::CannotConnectError }.should == 2
11
+ end
12
+
13
+ it "should return the given value if the block raises a Redis::TimeoutError" do
14
+ Red.new.execute_with_uncertainty(2) { raise Redis::TimeoutError }.should == 2
15
+ end
16
+ end
17
+
4
18
  describe "#multi_with_caution" do
5
19
  it "should not try call discard if the multi fails" do
6
20
  Red.redis.stub(:multi).and_raise(Redis::TimeoutError)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redness
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: