lita 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lita/handler.rb +7 -0
- data/lib/lita/version.rb +1 -1
- data/spec/lita/handler_spec.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9bd8c0df22178884dc917ba0160f0eb1bc3b2dc
|
4
|
+
data.tar.gz: 79089bd4df8880b869b444b7dc98e9bb492fde20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4de9444af3c84c039b113a5f3a5a0659cfb91f4438b607f61f5e3030b03cd90cd950403f855dc0e9e208a8324c535f85fba61628d7ac46f346947190b7d0eea5
|
7
|
+
data.tar.gz: 5bca9f0a44ac91b26e3519f02f9add4bb0569624d12f76b99102e5ae40057975744c7b0dc46b9c2a0fe26c0865697a69e83360c38b1c0a3ed0e91d2732693e30
|
data/lib/lita/handler.rb
CHANGED
@@ -67,6 +67,7 @@ LOG
|
|
67
67
|
#{e.message}
|
68
68
|
#{e.backtrace.join("\n")}
|
69
69
|
ERROR
|
70
|
+
raise e if rspec_loaded?
|
70
71
|
end
|
71
72
|
end
|
72
73
|
end
|
@@ -116,6 +117,12 @@ ERROR
|
|
116
117
|
|
117
118
|
true
|
118
119
|
end
|
120
|
+
|
121
|
+
# Checks if RSpec is loaded. If so, assume we are testing and let handler
|
122
|
+
# exceptions bubble up.
|
123
|
+
def rspec_loaded?
|
124
|
+
defined?(::RSpec)
|
125
|
+
end
|
119
126
|
end
|
120
127
|
|
121
128
|
# @param robot [Lita::Robot] The currently running robot.
|
data/lib/lita/version.rb
CHANGED
data/spec/lita/handler_spec.rb
CHANGED
@@ -93,11 +93,17 @@ describe Lita::Handler, lita: true do
|
|
93
93
|
|
94
94
|
it "logs exceptions but doesn't crash the bot" do
|
95
95
|
allow(message).to receive(:body).and_return("#{robot.name}: danger")
|
96
|
+
allow(handler_class).to receive(:rspec_loaded?).and_return(false)
|
96
97
|
expect(Lita.logger).to receive(:error).with(
|
97
98
|
%r{Lita::Handlers::Test crashed}
|
98
99
|
)
|
99
100
|
expect { handler_class.dispatch(robot, message) }.not_to raise_error
|
100
101
|
end
|
102
|
+
|
103
|
+
it "re-raises exceptions when testing with RSpec" do
|
104
|
+
allow(message).to receive(:body).and_return("#{robot.name}: danger")
|
105
|
+
expect { handler_class.dispatch(robot, message) }.to raise_error
|
106
|
+
end
|
101
107
|
end
|
102
108
|
|
103
109
|
describe ".namespace" do
|