lita 4.0.2 → 4.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 587288247dc60338bb91eb3914f9d40d3ca8a59a
4
- data.tar.gz: d015472e6b10d7cecc199b89e4164d8430297f06
3
+ metadata.gz: 21f001a7ad45ff1f2e3a87b07a5eecdc94c27669
4
+ data.tar.gz: 8e1369a2294bc07f39f0a360daa1b07ba4d4d3d5
5
5
  SHA512:
6
- metadata.gz: 506d911b55c472c89625f9de45a6d22054b958ad68092e1d873844e4b453c77ed6c635b5c8447a5405ebec0249e4b21dd7d35ef1393b948802ccbb6a583d68bb
7
- data.tar.gz: 0ea3074f7d44da4b24f8440ecf909aa9b7b5ee1b1c011f603d57e6f9c97e4b7288d24ac210d042c56b9471990db74aa028034a5b54745f27e9f17054bc683b9e
6
+ metadata.gz: 19cb7bc31c045032d5dad49affce04967068ad982288ac63b10374542ad81364daba7fbde3ac2e1d71231b42bc8722e0fcb7d2229f3173b91c22993d95d999f3
7
+ data.tar.gz: 1ab1fd0f6b5b81bd1193dfcd2793a15279fb790211988aa6261870a793768f70e7db3ce46923548c27306c173532ac0fc84545ce5bcb4b596281ef05ed211008
@@ -52,12 +52,16 @@ module Lita
52
52
  begin
53
53
  client.ping
54
54
  rescue Redis::BaseError => e
55
- Lita.logger.fatal I18n.t(
56
- "lita.redis.exception",
57
- message: e.message,
58
- backtrace: e.backtrace.join("\n")
59
- )
60
- abort
55
+ if Lita.test_mode?
56
+ raise RedisError, I18n.t("lita.redis.test_mode_exception", message: e.message)
57
+ else
58
+ Lita.logger.fatal I18n.t(
59
+ "lita.redis.exception",
60
+ message: e.message,
61
+ backtrace: e.backtrace.join("\n")
62
+ )
63
+ abort
64
+ end
61
65
  end
62
66
  end
63
67
  end
@@ -7,4 +7,8 @@ module Lita
7
7
  # violated by the default value of the attribute.
8
8
  # @since 4.0.0
9
9
  class ValidationError < Error; end
10
+
11
+ # An exception raised when Lita can't connect to Redis in test mode.
12
+ # @since 4.0.3
13
+ class RedisError < Error; end
10
14
  end
@@ -1,4 +1,4 @@
1
1
  module Lita
2
2
  # The current version of Lita.
3
- VERSION = "4.0.2"
3
+ VERSION = "4.0.3"
4
4
  end
@@ -75,11 +75,25 @@ describe Lita do
75
75
  expect(described_class.redis).to eql(described_class.redis)
76
76
  end
77
77
 
78
- it "logs a fatal warning and raises an exception if it can't connection to Redis" do
78
+ it "raises a RedisError if it can't connect to Redis" do
79
79
  allow(redis_namespace).to receive(:ping).and_raise(Redis::CannotConnectError)
80
+ expect { Lita.redis }.to raise_error(Lita::RedisError, /could not connect to Redis/)
81
+ end
82
+
83
+ context "with test mode off" do
84
+ around do |example|
85
+ test_mode = Lita.test_mode?
86
+ Lita.test_mode = false
87
+ example.run
88
+ Lita.test_mode = test_mode
89
+ end
80
90
 
81
- expect(Lita.logger).to receive(:fatal)
82
- expect { Lita.redis }.to raise_error(SystemExit)
91
+ it "logs a fatal warning and raises an exception if it can't connect to Redis" do
92
+ allow(redis_namespace).to receive(:ping).and_raise(Redis::CannotConnectError)
93
+
94
+ expect(Lita.logger).to receive(:fatal)
95
+ expect { Lita.redis }.to raise_error(SystemExit)
96
+ end
83
97
  end
84
98
  end
85
99
 
@@ -113,6 +113,9 @@ en:
113
113
  %{message}
114
114
  Full backtrace:
115
115
  %{backtrace}
116
+ test_mode_exception: |
117
+ Lita could not connect to Redis. The exception was:
118
+ %{message}
116
119
  robot:
117
120
  unknown_adapter: "Unknown adapter: :%{adapter}."
118
121
  rspec:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.2
4
+ version: 4.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jimmy Cuadra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-01 00:00:00.000000000 Z
11
+ date: 2014-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler