em-dextras 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/em-dextras.gemspec +1 -1
- data/lib/em-dextras/chains.rb +8 -0
- data/lib/em-dextras/version.rb +1 -1
- data/spec/em-dextras/chains_spec.rb +15 -1
- metadata +3 -3
data/em-dextras.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.email = ["public@rafaelferreira.net"]
|
7
7
|
gem.description = %q{Utilities to help working with EventMachine deferrables.}
|
8
8
|
gem.summary = %q{Utilities to help working with EventMachine Deferrables. Includes probes for asynchronous tests and a DSL to chain deferrables.}
|
9
|
-
gem.homepage = ""
|
9
|
+
gem.homepage = "https://github.com/rafaeldff/em-dextras"
|
10
10
|
|
11
11
|
gem.files = `git ls-files`.split($\)
|
12
12
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
data/lib/em-dextras/chains.rb
CHANGED
@@ -161,6 +161,14 @@ module EMDextras
|
|
161
161
|
end
|
162
162
|
|
163
163
|
def self.call(stage, input, pipe_setup)
|
164
|
+
begin
|
165
|
+
do_call stage, input, pipe_setup
|
166
|
+
rescue => e
|
167
|
+
EMDextras::Chains::Deferrables.failed e
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
def self.do_call(stage, input, pipe_setup)
|
164
172
|
todo_method = stage.method(:todo)
|
165
173
|
arity = todo_method.arity
|
166
174
|
if arity < 0 && pipe_setup.options[:context]
|
data/lib/em-dextras/version.rb
CHANGED
@@ -34,6 +34,12 @@ describe EMDextras::Chains do
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
+
class RaisingExceptionStage
|
38
|
+
def todo(input)
|
39
|
+
raise StandardError, input.to_s
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
37
43
|
class InvalidStage
|
38
44
|
def todo(input)
|
39
45
|
"not-a-deferrable"
|
@@ -156,7 +162,7 @@ describe EMDextras::Chains do
|
|
156
162
|
end
|
157
163
|
|
158
164
|
context "- monitoring -" do
|
159
|
-
it "should notify monitoring of any
|
165
|
+
it "should notify monitoring of any failure" do
|
160
166
|
EM.run do
|
161
167
|
EMDextras::Chains.pipe("anything", monitoring, [ErrorStage.new]);
|
162
168
|
|
@@ -164,6 +170,14 @@ describe EMDextras::Chains do
|
|
164
170
|
end
|
165
171
|
end
|
166
172
|
|
173
|
+
it "should notify monitoring of any exception" do
|
174
|
+
EM.run do
|
175
|
+
EMDextras::Chains.pipe("will raise", monitoring, [RaisingExceptionStage.new]);
|
176
|
+
|
177
|
+
monitoring.received_call!(:inform_exception!, any_args)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
167
181
|
it "should pass the context to monitoring.inform_exception if given" do
|
168
182
|
EM.run do
|
169
183
|
error_stage = ErrorStage.new
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: em-dextras
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
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-
|
12
|
+
date: 2013-05-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: eventmachine
|
@@ -164,7 +164,7 @@ files:
|
|
164
164
|
- spec/em-dextras/spec/spec_matchers_spec.rb
|
165
165
|
- spec/em-dextras/spec/spy_spec.rb
|
166
166
|
- spec/spec_helper.rb
|
167
|
-
homepage:
|
167
|
+
homepage: https://github.com/rafaeldff/em-dextras
|
168
168
|
licenses: []
|
169
169
|
post_install_message:
|
170
170
|
rdoc_options: []
|