reactor 0.8.1 → 0.8.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: c458036301b887cea2e6e656cd94ed497750ebed
4
- data.tar.gz: 706f502c1bbbac9172374b7b065ddb627f3de656
3
+ metadata.gz: 95dc37409d0b41598fd79e08c761e3024bffd663
4
+ data.tar.gz: dc006fba8540a1a2ee3d18b2a0280c83fac78364
5
5
  SHA512:
6
- metadata.gz: 1b5ebaf7f01782274bbd324789f138e6fc82af0de759d624d63e6c50f553783ff4be37b774d365086984e64ef11367777d4f98f108533a6b1ebc3a6532d64c65
7
- data.tar.gz: e0f664ec820fcaa59c7a181bceffdb3b049799f841ccced731392e21b1e6453bacfafc2460b3010fca64ae083d17fcd0ae674484c0c955ecb5f208399c4d6487
6
+ metadata.gz: c96bc020fefc6c9eb331e32a7b71db10403088ba23228cf73c0b9d66a0861a720351f1773293bf0c80b0296186e20f31af0d141f0707ae8af33556001f91ef96
7
+ data.tar.gz: 8e934d6d187cb1f08f8492758f87441a023db7d164a8272f4632e5f164244f7fff6f91819efb2e808b9f254ced744f652f4d2dde849be3d0377c33fe834de5fc
data/lib/reactor/event.rb CHANGED
@@ -2,8 +2,6 @@ class Reactor::Event
2
2
  include Reactor::OptionallySubclassable
3
3
  include Sidekiq::Worker
4
4
 
5
- class UnserializableModelKeysIncluded < StandardError; end;
6
-
7
5
  attr_accessor :data
8
6
 
9
7
  def initialize(data = {})
@@ -37,8 +35,6 @@ class Reactor::Event
37
35
  end
38
36
 
39
37
  def publish(name, data = {})
40
- enforce_serializable_model_keys!(data)
41
-
42
38
  message = new(data.merge(event: name))
43
39
 
44
40
  if message.at.nil?
@@ -59,22 +55,6 @@ class Reactor::Event
59
55
  job.delete
60
56
  publish(name, data.except(:was)) if data[:at].future?
61
57
  end
62
-
63
- private
64
-
65
- def enforce_serializable_model_keys!(event_signature)
66
- event_signature = event_signature.stringify_keys
67
- serializable_models = event_signature.keys.map(&:to_s).select { |k| k.end_with?('_id') || k.end_with?('_type') }
68
- .map { |k| k.gsub(/_id\Z/, '') }
69
- .map { |k| k.gsub(/_type\Z/, '') }
70
- .uniq
71
-
72
- serializable_models.each do |model_relation_name|
73
- raise UnserializableModelKeysIncluded, "#{model_relation_name}_type is missing corresponding _id key" if event_signature["#{model_relation_name}_id"].blank?
74
- raise UnserializableModelKeysIncluded, "#{model_relation_name}_id is missing corresponding _type key" if event_signature["#{model_relation_name}_type"].blank?
75
-
76
- end
77
- end
78
58
  end
79
59
 
80
60
  private
@@ -1,3 +1,3 @@
1
1
  module Reactor
2
- VERSION = "0.8.1"
2
+ VERSION = "0.8.2"
3
3
  end
data/spec/event_spec.rb CHANGED
@@ -18,20 +18,8 @@ describe Reactor::Event do
18
18
 
19
19
  describe 'publish' do
20
20
  it 'fires the first perform and sets message event_id' do
21
- expect(Reactor::Event).to receive(:perform_async).with(event_name, 'actor_id' => '1', 'actor_type' => 'Pet', 'event' => :user_did_this)
22
- Reactor::Event.publish(:user_did_this, actor_id: '1', actor_type: 'Pet')
23
- end
24
-
25
- context 'x_id is included but x_type is not' do
26
- it 'raises an exception' do
27
- expect { Reactor::Event.publish(:user_did_something, actor_id: '1') }.to raise_error
28
- end
29
- end
30
-
31
- context 'x_type is included but x_id is not' do
32
- it 'raises an exception' do
33
- expect { Reactor::Event.publish(:user_did_something, actor_type: 'Pet') }.to raise_error
34
- end
21
+ Reactor::Event.should_receive(:perform_async).with(event_name, 'actor_id' => '1', 'event' => :user_did_this)
22
+ Reactor::Event.publish(:user_did_this, actor_id: '1')
35
23
  end
36
24
  end
37
25
 
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.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - winfred