reactor 0.12.1 → 0.12.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a875645d8c1549921096a747103a1a7af62180c2
4
- data.tar.gz: ce40f2f7f17011fe49e54f9a30587ea45c7be874
3
+ metadata.gz: 8241a3de8050e5f19503c616d3604571f6e67e52
4
+ data.tar.gz: 086fb218d96c3c49c96750e22cbda5ecf70a9483
5
5
  SHA512:
6
- metadata.gz: f8e4d71a75a7d579950253820e1eb50e41525d10313f446a778e1c09bd39053cb6c97a0e478b1b47c2a4f190979101e5a1a770c96dcea5474d3fa585f14131ed
7
- data.tar.gz: 55489b1ddc957731b19060258d2f916e4ddda221558f715dc150db902cde93329f5798acb4085f637d2ef48437cb39c76ddd84f308e45a26754365afadaf43a2
6
+ metadata.gz: 247f4e9a9ffddcf15fa1d44b6131b1b22e597ab651ffb78ac4aba04bd1d1af3ef9949d94ed50962611f3ef90c6a2f575b6f12630cb0e8c4a48b866b34c7e02d3
7
+ data.tar.gz: 284d161eaf8aa11c1b0376449e3b3e8ff57970b614aebaf2ca4f02b41f4f5b200048f3b92b37b6e7360ac59f85f7f44812cdc66e99e587dffff4089e41416ee8
data/Changes.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Reactor Change Log
2
2
 
3
+ 0.12.2
4
+ -----------
5
+ Correctly handles exceptions in `with_subscriber_enabled`
6
+
3
7
  0.12.1
4
8
  -----------
5
9
  Fix unicode encoding protection to allow valid multi-byte unicode characters
@@ -1,3 +1,3 @@
1
1
  module Reactor
2
- VERSION = "0.12.1"
2
+ VERSION = "0.12.2"
3
3
  end
data/lib/reactor.rb CHANGED
@@ -42,6 +42,7 @@ module Reactor
42
42
  def self.with_subscriber_enabled(klass)
43
43
  enable_test_mode_subscriber klass
44
44
  yield if block_given?
45
+ ensure
45
46
  disable_test_mode_subscriber klass
46
47
  end
47
48
  end
data/spec/reactor_spec.rb CHANGED
@@ -34,6 +34,24 @@ describe Reactor do
34
34
  Reactor::Event.publish :test_event
35
35
  end
36
36
  end
37
+
38
+ it 'disables the subscriber outside the block' do
39
+ expect(Reactor::TEST_MODE_SUBSCRIBERS).to be_empty
40
+ Reactor.with_subscriber_enabled(subscriber) do
41
+ expect(Reactor::TEST_MODE_SUBSCRIBERS).to contain_exactly(subscriber)
42
+ end
43
+ expect(Reactor::TEST_MODE_SUBSCRIBERS).to be_empty
44
+ end
45
+
46
+ it 'correctly handles exceptions inside the block' do
47
+ expect(Reactor::TEST_MODE_SUBSCRIBERS).to be_empty
48
+ expect {
49
+ Reactor.with_subscriber_enabled(subscriber) do
50
+ raise RuntimeError
51
+ end
52
+ }.to raise_error(RuntimeError)
53
+ expect(Reactor::TEST_MODE_SUBSCRIBERS).to be_empty
54
+ end
37
55
  end
38
56
  end
39
57
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reactor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - winfred
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-04-12 00:00:00.000000000 Z
14
+ date: 2016-06-17 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: sidekiq