rabbit_feed 2.3.4 → 2.3.5

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: b3f8f9a636fd9c4329571387c7418d6fd977f195
4
- data.tar.gz: 6a1de38edebf587075b7193eb391fe18991ade52
3
+ metadata.gz: 13c0b3905b75108e5d82a42919b6e03339f948fd
4
+ data.tar.gz: 94fe1338ad1e1ee224f14936635286d8f71f8cce
5
5
  SHA512:
6
- metadata.gz: af781a201c09f92e0df78c03eec0adbb0e1c63150dfea59c2bafbe1b4b3215bf577a34ec5926ff976e05272d29f8023dee0e783e91689e0268615ce2d6bc3aa0
7
- data.tar.gz: 4bd6a926772400c407fdcc9ffc295d632fabd05257c0cd0c038d70235d91462e6da1d3f1820b83513e9fc0c1b024a5f909563cdc63a8b8a958d06100e01920eb
6
+ metadata.gz: d5d1e68fd21fa50fcedd8469b90eb114a325e853bc37093abea3bb61d29a958fd9fb9b50a8ee2d24c52ef2eb581fdcc15b6306a7922b236175e8f9bb42503637
7
+ data.tar.gz: 54c4625902a2d5115b2818630a37187cb349adeb00f09d26be7eb7c02e824fb04b36518447c21a6e673c3fc0e1f3ee84b96c879260b219a1c16a99f255e2f342
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rabbit_feed (2.3.4)
4
+ rabbit_feed (2.3.5)
5
5
  activemodel (>= 3.2.0, < 5.0.0)
6
6
  activesupport (>= 3.2.0, < 5.0.0)
7
7
  avro (>= 1.5.4, < 1.8.0)
@@ -11,10 +11,10 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- activemodel (4.2.4)
15
- activesupport (= 4.2.4)
14
+ activemodel (4.2.5)
15
+ activesupport (= 4.2.5)
16
16
  builder (~> 3.1)
17
- activesupport (4.2.4)
17
+ activesupport (4.2.5)
18
18
  i18n (~> 0.7)
19
19
  json (~> 1.7, >= 1.7.7)
20
20
  minitest (~> 5.1)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../
3
3
  specs:
4
- rabbit_feed (2.3.4)
4
+ rabbit_feed (2.3.5)
5
5
  activemodel (>= 3.2.0, < 5.0.0)
6
6
  activesupport (>= 3.2.0, < 5.0.0)
7
7
  avro (>= 1.5.4, < 1.8.0)
@@ -11,10 +11,10 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- activemodel (4.2.4)
15
- activesupport (= 4.2.4)
14
+ activemodel (4.2.5)
15
+ activesupport (= 4.2.5)
16
16
  builder (~> 3.1)
17
- activesupport (4.2.4)
17
+ activesupport (4.2.5)
18
18
  i18n (~> 0.7)
19
19
  json (~> 1.7, >= 1.7.7)
20
20
  minitest (~> 5.1)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../
3
3
  specs:
4
- rabbit_feed (2.3.4)
4
+ rabbit_feed (2.3.5)
5
5
  activemodel (>= 3.2.0, < 5.0.0)
6
6
  activesupport (>= 3.2.0, < 5.0.0)
7
7
  avro (>= 1.5.4, < 1.8.0)
@@ -46,7 +46,7 @@ GEM
46
46
  minitest (~> 5.1)
47
47
  thread_safe (~> 0.3, >= 0.3.4)
48
48
  tzinfo (~> 1.1)
49
- amq-protocol (2.0.0)
49
+ amq-protocol (2.0.1)
50
50
  arel (6.0.0)
51
51
  avro (1.7.7)
52
52
  multi_json
@@ -2,7 +2,7 @@ module RabbitFeed
2
2
  module TestingSupport
3
3
  module RSpecMatchers
4
4
  class PublishEvent
5
- attr_reader :expected_event, :expected_payload
5
+ attr_reader :expected_event
6
6
 
7
7
  def initialize(expected_event, expected_payload)
8
8
  @expected_event = expected_event
@@ -59,8 +59,22 @@ module RabbitFeed
59
59
  true
60
60
  end
61
61
 
62
+ def with(expected_payload=nil, &block)
63
+ if !!@expected_payload
64
+ ::Kernel.warn "`publish_event` was called with an expected payload already, anything in `with` is ignored"
65
+ else
66
+ @expected_payload = expected_payload
67
+ end
68
+
69
+ self
70
+ end
71
+
62
72
  private
63
73
 
74
+ def expected_payload
75
+ @expected_payload.respond_to?(:call) ? @expected_payload.call : @expected_payload
76
+ end
77
+
64
78
  def received_events_message
65
79
  if TestingSupport.published_events.any?
66
80
  TestingSupport.published_events.map do |received_event|
@@ -1,3 +1,3 @@
1
1
  module RabbitFeed
2
- VERSION = '2.3.4'
2
+ VERSION = '2.3.5'
3
3
  end
@@ -62,10 +62,22 @@ module RabbitFeed
62
62
  (matcher.matches? block).should be_falsey
63
63
  end
64
64
 
65
- it 'validates the event payload' do
66
- matcher = described_class.new(event_name, event_payload)
67
- block = Proc.new { RabbitFeed::Producer.publish_event event_name, {'field' => 'different value'} }
68
- (matcher.matches? block).should be_falsey
65
+ context 'when validating the payload' do
66
+ context 'and the payload is not a Proc' do
67
+ it 'validates the event payload' do
68
+ matcher = described_class.new(event_name, event_payload)
69
+ block = Proc.new { RabbitFeed::Producer.publish_event event_name, {'field' => 'different value'} }
70
+ (matcher.matches? block).should be_falsey
71
+ end
72
+ end
73
+
74
+ context 'and the payload is a Proc' do
75
+ it 'validates the event payload' do
76
+ matcher = described_class.new(event_name, event_payload)
77
+ block = Proc.new { RabbitFeed::Producer.publish_event(event_name).with{{'field' => 'different value'}} }
78
+ (matcher.matches? block).should be_falsey
79
+ end
80
+ end
69
81
  end
70
82
  end
71
83
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbit_feed
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.4
4
+ version: 2.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simply Business
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-14 00:00:00.000000000 Z
11
+ date: 2016-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny