wisper 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +10 -3
- data/CHANGELOG.md +87 -0
- data/Gemfile +7 -1
- data/README.md +56 -24
- data/Rakefile +4 -1
- data/lib/wisper.rb +15 -2
- data/lib/wisper/rspec/matchers.rb +57 -0
- data/lib/wisper/rspec/stub_wisper_publisher.rb +0 -3
- data/lib/wisper/temporary_listeners.rb +6 -3
- data/lib/wisper/version.rb +1 -1
- data/spec/lib/async_spec.rb +1 -1
- data/spec/lib/global_subscribers_spec.rb +13 -13
- data/spec/lib/integration_spec.rb +6 -6
- data/spec/lib/simple_example_spec.rb +2 -2
- data/spec/lib/temporary_global_listeners_spec.rb +19 -8
- data/spec/lib/wisper/publisher_spec.rb +42 -41
- data/spec/lib/wisper/rspec/matchers_spec.rb +18 -0
- data/spec/lib/{rspec_extensions_spec.rb → wisper/rspec/stub_wisper_publisher_spec.rb} +2 -3
- data/spec/lib/wisper_spec.rb +60 -9
- data/spec/spec_helper.rb +4 -8
- data/wisper.gemspec +0 -2
- metadata +37 -45
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c905b4f311d82eadf52d61a11a0515109335d592
|
4
|
+
data.tar.gz: 9be198a62d94f3c8fbc46253cd109a438d857206
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 44ddd88e30752991d23dafa678086611a05f0206f152066b18b0283b0eb9462728b06be38f46fdf08caba0ead38919e88530ad1566cc2d8d92d751813805e851
|
7
|
+
data.tar.gz: d7ee6c49e1c6320596e00f1a79624e8ea3bb7f413b4fa76348415e3ff40225772522d1f861946dd83aaf1fbff0e86a89eccb72dd0dca1ca91843a72d78a3193a
|
data/.travis.yml
CHANGED
@@ -5,6 +5,13 @@ rvm:
|
|
5
5
|
- '1.9.2'
|
6
6
|
- '1.9.3'
|
7
7
|
- '2.0.0'
|
8
|
-
-
|
9
|
-
- jruby
|
10
|
-
- rbx
|
8
|
+
- '2.1.2'
|
9
|
+
- jruby
|
10
|
+
- rbx-2
|
11
|
+
### ALLOWED FAILURES ###
|
12
|
+
# see how compatible we are with dev versions, but do not fail the build
|
13
|
+
- ruby-head
|
14
|
+
- jruby-head
|
15
|
+
allow_failures:
|
16
|
+
- rvm: ruby-head
|
17
|
+
- rvm: jruby-head
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
## Unreleased (no breaking changes)
|
2
|
+
|
3
|
+
None
|
4
|
+
|
5
|
+
## 1.4.0 (8th Sept 2014)
|
6
|
+
|
7
|
+
Authors: Kris Leech, Marc Ignacio, Ahmed Abdel Razzak, kmehkeri, Jake Hoffner
|
8
|
+
|
9
|
+
* feature: matcher for rspec 3
|
10
|
+
* fix: temporary global listeners are cleared if an exception is raised
|
11
|
+
* refactor: update all specs to rspec 3 expect syntax
|
12
|
+
* docs: update README to rspec 3 expect syntax
|
13
|
+
* feature: combine global and temporary listener methods as `Wisper.subscribe`
|
14
|
+
* deprecate: `Wisper.add_listener` and `Wisper.with_listeners,` use `Wisper.subscribe` instead
|
15
|
+
|
16
|
+
## 1.3.0 (18th Jan 2014)
|
17
|
+
|
18
|
+
Authors: Kris Leech, Yan Pritzker, Charlie Tran
|
19
|
+
|
20
|
+
* feature: global subscriptions can be scoped to a class (and sub-classes)
|
21
|
+
* upgrade: use rspec 3
|
22
|
+
* feature: allow prefixing of events with 'on'
|
23
|
+
* feature: Allow stubbed publisher method to accept arbitrary args
|
24
|
+
|
25
|
+
## 1.2.1 (7th Oct 2013)
|
26
|
+
|
27
|
+
Authors: Kris Leech, Tomasz Szymczyszyn, Alex Heeton
|
28
|
+
|
29
|
+
* feature: global subscriptions can be passed options
|
30
|
+
* docs: improve README examples
|
31
|
+
* docs: add license to gemspec
|
32
|
+
|
33
|
+
## 1.2.0 (21st July 2013)
|
34
|
+
|
35
|
+
Authors: Kris Leech, Darren Coxall
|
36
|
+
|
37
|
+
* feature: support for multiple events at once
|
38
|
+
* fix: clear global listeners after each spec
|
39
|
+
|
40
|
+
## 1.1.0 (7th June 2013)
|
41
|
+
|
42
|
+
Authors: Kris Leech, chatgris
|
43
|
+
|
44
|
+
* feature: add temporary global listeners
|
45
|
+
* docs: improve ActiveRecord example
|
46
|
+
* refactor: improve specs
|
47
|
+
* upgrade: add Ruby 2.0 support
|
48
|
+
* fix: make listener collection immutable
|
49
|
+
* remove: async publishing and Celluloid dependency
|
50
|
+
* fix: Make global listeners getter and setter threadsafe [9]
|
51
|
+
|
52
|
+
## 1.0.1 (2nd May 2013)
|
53
|
+
|
54
|
+
Authors: Kris Leech, Yan Pritzker
|
55
|
+
|
56
|
+
* feature: add async publishing using Celluloid
|
57
|
+
* docs: improve README examples
|
58
|
+
* feature: `stub_wisper_publisher` rspec helper
|
59
|
+
* feature: global listeners
|
60
|
+
* refactor: improve specs
|
61
|
+
|
62
|
+
## 1.0.0 (7th April 2013)
|
63
|
+
|
64
|
+
Authors: Kris Leech
|
65
|
+
|
66
|
+
* refactor: specs
|
67
|
+
* refactor: registrations
|
68
|
+
* feature: Add `with` argument to `subscribe`
|
69
|
+
* docs: improve README examples
|
70
|
+
* feature: Allow subscriptions to be chainable
|
71
|
+
* feature: Add `on` syntax for block subscription
|
72
|
+
* remove: Remove support for Ruby 1.8.7
|
73
|
+
* docs: Add badges to README
|
74
|
+
|
75
|
+
## 0.0.2 (30th March 2013)
|
76
|
+
|
77
|
+
Authors: Kris Leech
|
78
|
+
|
79
|
+
* remove: ActiveSupport dependency
|
80
|
+
* docs: fix syntax highlighting in README
|
81
|
+
|
82
|
+
## 0.0.1 (30th March 2013)
|
83
|
+
|
84
|
+
Authors: Kris Leech
|
85
|
+
|
86
|
+
* docs: add README
|
87
|
+
* feature: registration of objects and blocks
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -3,8 +3,10 @@
|
|
3
3
|
Wisper is a Ruby library for decoupling and managing the dependencies of your
|
4
4
|
Ruby objects using Pub/Sub.
|
5
5
|
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/wisper.png)](http://badge.fury.io/rb/wisper)
|
6
7
|
[![Code Climate](https://codeclimate.com/github/krisleech/wisper.png)](https://codeclimate.com/github/krisleech/wisper)
|
7
8
|
[![Build Status](https://travis-ci.org/krisleech/wisper.png?branch=master)](https://travis-ci.org/krisleech/wisper)
|
9
|
+
[![Coverage Status](https://coveralls.io/repos/krisleech/wisper/badge.png?branch=master)](https://coveralls.io/r/krisleech/wisper?branch=master)
|
8
10
|
|
9
11
|
Wisper was extracted from a Rails codebase but is not dependant on Rails.
|
10
12
|
|
@@ -16,7 +18,7 @@ to reduce coupling between data and domain layers.
|
|
16
18
|
Add this line to your application's Gemfile:
|
17
19
|
|
18
20
|
```ruby
|
19
|
-
gem 'wisper'
|
21
|
+
gem 'wisper'
|
20
22
|
```
|
21
23
|
|
22
24
|
## Usage
|
@@ -76,7 +78,7 @@ Please refer to the [wisper-async](https://github.com/krisleech/wisper-async) ge
|
|
76
78
|
class Bid < ActiveRecord::Base
|
77
79
|
include Wisper::Publisher
|
78
80
|
|
79
|
-
validates :amount, :
|
81
|
+
validates :amount, presence: true
|
80
82
|
|
81
83
|
def commit(_attrs = nil)
|
82
84
|
assign_attributes(_attrs) if _attrs.present?
|
@@ -106,7 +108,7 @@ class BidsController < ApplicationController
|
|
106
108
|
@bid.subscribe(StatisticsListener.new)
|
107
109
|
|
108
110
|
@bid.on(:create_bid_successful) { |bid| redirect_to bid }
|
109
|
-
@bid.on(:create_bid_failed) { |bid| render :
|
111
|
+
@bid.on(:create_bid_failed) { |bid| render action: :new }
|
110
112
|
|
111
113
|
@bid.commit
|
112
114
|
end
|
@@ -205,7 +207,7 @@ obvious on reading the code and of course you are introducing global state and
|
|
205
207
|
'always on' behaviour. This may not desirable.
|
206
208
|
|
207
209
|
```ruby
|
208
|
-
Wisper.
|
210
|
+
Wisper.subscribe(MyListener.new)
|
209
211
|
```
|
210
212
|
|
211
213
|
In a Rails app you might want to add your global listeners in an initalizer.
|
@@ -218,7 +220,7 @@ You might want to globally subscribe a listener to publishers with a certain
|
|
218
220
|
class.
|
219
221
|
|
220
222
|
```ruby
|
221
|
-
Wisper.
|
223
|
+
Wisper.subscribe(MyListener.new, scope: :MyPublisher)
|
222
224
|
```
|
223
225
|
|
224
226
|
This will subscribe the listener to all instances of `MyPublisher` and its
|
@@ -227,7 +229,7 @@ subclasses.
|
|
227
229
|
Alternatively you can also do exactly the same with a publisher class:
|
228
230
|
|
229
231
|
```ruby
|
230
|
-
MyPublisher.
|
232
|
+
MyPublisher.subscribe(MyListener.new)
|
231
233
|
```
|
232
234
|
|
233
235
|
## Temporary Global Listeners
|
@@ -235,7 +237,7 @@ MyPublisher.add_listener(MyListener.new)
|
|
235
237
|
You can also globally subscribe listeners for the duration of a block.
|
236
238
|
|
237
239
|
```ruby
|
238
|
-
Wisper.
|
240
|
+
Wisper.subscribe(MyListener.new, OtherListener.new) do
|
239
241
|
# do stuff
|
240
242
|
end
|
241
243
|
```
|
@@ -250,19 +252,19 @@ Temporary Global Listeners are threadsafe.
|
|
250
252
|
|
251
253
|
By default a listener will get notified of all events it can respond to. You
|
252
254
|
can limit which events a listener is notified of by passing an event or array
|
253
|
-
of events to
|
255
|
+
of events to `on:`.
|
254
256
|
|
255
257
|
```ruby
|
256
|
-
post_creater.subscribe(PusherListener.new, :
|
258
|
+
post_creater.subscribe(PusherListener.new, on: :create_post_successful)
|
257
259
|
```
|
258
260
|
|
259
261
|
## Prefixing broadcast events
|
260
262
|
|
261
263
|
If you would prefer listeners to receive events with a prefix, for example
|
262
|
-
`on`, you can do so by passing a string or symbol to
|
264
|
+
`on`, you can do so by passing a string or symbol to `prefix:`.
|
263
265
|
|
264
266
|
```ruby
|
265
|
-
post_creater.subscribe(PusherListener.new, :
|
267
|
+
post_creater.subscribe(PusherListener.new, prefix: :on)
|
266
268
|
```
|
267
269
|
|
268
270
|
If `post_creater` where to broadcast the event `post_created` the subscribed
|
@@ -272,42 +274,72 @@ use the default prefix, "on".
|
|
272
274
|
## Mapping an event to a different method
|
273
275
|
|
274
276
|
By default the method called on the subscriber is the same as the event
|
275
|
-
broadcast. However it can be mapped to a different method using
|
277
|
+
broadcast. However it can be mapped to a different method using `with:`.
|
276
278
|
|
277
279
|
```ruby
|
278
|
-
report_creator.subscribe(MailResponder.new, :
|
280
|
+
report_creator.subscribe(MailResponder.new, with: :successful)
|
279
281
|
```
|
280
282
|
|
281
|
-
This is pretty useless unless used in conjuction with
|
283
|
+
This is pretty useless unless used in conjuction with `on:`, since all events
|
282
284
|
will get mapped to `:successful`. Instead you might do something like this:
|
283
285
|
|
284
286
|
```ruby
|
285
|
-
report_creator.subscribe(MailResponder.new, :
|
286
|
-
:
|
287
|
+
report_creator.subscribe(MailResponder.new, on: :create_report_successful,
|
288
|
+
with: :successful)
|
287
289
|
```
|
288
290
|
|
289
|
-
If you pass an array of events to
|
290
|
-
method when
|
291
|
+
If you pass an array of events to `on:` each event will be mapped to the same
|
292
|
+
method when `with:` is specified. If you need to listen for select events
|
291
293
|
_and_ map each one to a different method subscribe the listener once for
|
292
294
|
each mapping:
|
293
295
|
|
294
296
|
```ruby
|
295
|
-
report_creator.subscribe(MailResponder.new, :
|
296
|
-
:
|
297
|
+
report_creator.subscribe(MailResponder.new, on: :create_report_successful,
|
298
|
+
with: :successful)
|
297
299
|
|
298
|
-
report_creator.subscribe(MailResponder.new, :
|
299
|
-
:
|
300
|
+
report_creator.subscribe(MailResponder.new, on: :create_report_failed,
|
301
|
+
with: :failed)
|
300
302
|
```
|
301
303
|
|
302
304
|
## Chaining subscriptions
|
303
305
|
|
304
306
|
```ruby
|
305
307
|
post.on(:success) { |post| redirect_to post }
|
306
|
-
.on(:failure) { |post| render :
|
308
|
+
.on(:failure) { |post| render action: :edit, locals: { post: post } }
|
307
309
|
```
|
308
310
|
|
309
311
|
## RSpec
|
310
312
|
|
313
|
+
### Broadcast Matcher
|
314
|
+
|
315
|
+
```ruby
|
316
|
+
require 'wisper/rspec/matchers'
|
317
|
+
|
318
|
+
RSpec::configure do |config|
|
319
|
+
config.include(Wisper::RSpec::BroadcastMatcher)
|
320
|
+
end
|
321
|
+
|
322
|
+
expect { publisher.execute }.to broadcast(:an_event)
|
323
|
+
```
|
324
|
+
|
325
|
+
### Using message expections
|
326
|
+
|
327
|
+
If you need to assert on the arguments broadcast you can subscribe a double
|
328
|
+
with a [message expection](https://github.com/rspec/rspec-mocks#message-expectations)
|
329
|
+
and then use any of the [argument matchers](https://github.com/rspec/rspec-mocks#argument-matchers).
|
330
|
+
|
331
|
+
```ruby
|
332
|
+
listener = double('Listener')
|
333
|
+
|
334
|
+
expect(listener).to receive(:an_event).with(some_args)
|
335
|
+
|
336
|
+
publisher.subscribe(listener)
|
337
|
+
|
338
|
+
publisher.execute
|
339
|
+
```
|
340
|
+
|
341
|
+
### Stubbing publishers
|
342
|
+
|
311
343
|
Wisper comes with a method for stubbing event publishers so that you can create
|
312
344
|
isolation tests that only care about reacting to events.
|
313
345
|
|
@@ -338,7 +370,7 @@ describe CodeThatReactsToEvents do
|
|
338
370
|
|
339
371
|
it "renders" do
|
340
372
|
response = CodeThatReactsToEvents.new.do_something
|
341
|
-
response.
|
373
|
+
expect(response).to eq "Hello with foo!"
|
342
374
|
end
|
343
375
|
end
|
344
376
|
end
|
data/Rakefile
CHANGED
data/lib/wisper.rb
CHANGED
@@ -14,10 +14,23 @@ module Wisper
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.with_listeners(*args, &block)
|
17
|
-
|
17
|
+
warn "[DEPRECATION] `use Wisper.subscribe` instead of `Wisper.with_listeners`"
|
18
|
+
self.subscribe(*args, &block)
|
18
19
|
end
|
19
20
|
|
20
21
|
def self.add_listener(listener, options = {})
|
21
|
-
|
22
|
+
warn "[DEPRECATION] `use Wisper.subscribe` instead of `Wisper.add_listener`"
|
23
|
+
self.subscribe(listener, options)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.subscribe(*args, &block)
|
27
|
+
if block_given?
|
28
|
+
TemporaryListeners.with(*args, &block)
|
29
|
+
else
|
30
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
31
|
+
args.each do |listener|
|
32
|
+
GlobalListeners.add(listener, options)
|
33
|
+
end
|
34
|
+
end
|
22
35
|
end
|
23
36
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'rspec/expectations'
|
2
|
+
|
3
|
+
module Wisper
|
4
|
+
module RSpec
|
5
|
+
class EventRecorder
|
6
|
+
def initialize
|
7
|
+
@broadcast_events = []
|
8
|
+
end
|
9
|
+
|
10
|
+
def respond_to?(method_name)
|
11
|
+
true
|
12
|
+
end
|
13
|
+
|
14
|
+
def method_missing(method_name, *args, &block)
|
15
|
+
@broadcast_events << method_name.to_s
|
16
|
+
end
|
17
|
+
|
18
|
+
def broadcast?(event_name)
|
19
|
+
@broadcast_events.include?(event_name.to_s)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
module BroadcastMatcher
|
24
|
+
class Matcher
|
25
|
+
def initialize(event)
|
26
|
+
@event = event
|
27
|
+
end
|
28
|
+
|
29
|
+
def supports_block_expectations?
|
30
|
+
true
|
31
|
+
end
|
32
|
+
|
33
|
+
def matches?(block)
|
34
|
+
event_recorder = EventRecorder.new
|
35
|
+
|
36
|
+
Wisper.subscribe(event_recorder) do
|
37
|
+
block.call
|
38
|
+
end
|
39
|
+
|
40
|
+
event_recorder.broadcast?(@event)
|
41
|
+
end
|
42
|
+
|
43
|
+
def failure_message
|
44
|
+
"expected publisher to broadcast #{@event} event"
|
45
|
+
end
|
46
|
+
|
47
|
+
def failure_message_when_negated
|
48
|
+
"expected publisher not to broadcast #{@event} event"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def broadcast(event)
|
53
|
+
Matcher.new(event)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/wisper/version.rb
CHANGED
data/spec/lib/async_spec.rb
CHANGED
@@ -5,6 +5,6 @@ describe 'async option' do
|
|
5
5
|
let(:publisher) { publisher_class.new }
|
6
6
|
|
7
7
|
it 'it raises a deprecation exception' do
|
8
|
-
|
8
|
+
expect { publisher.add_listener(listener, :async => true) }.to raise_error
|
9
9
|
end
|
10
10
|
end
|
@@ -8,15 +8,15 @@ describe Wisper::GlobalListeners do
|
|
8
8
|
describe '.add' do
|
9
9
|
it 'adds given listener to every publisher' do
|
10
10
|
Wisper::GlobalListeners.add(global_listener)
|
11
|
-
global_listener.
|
11
|
+
expect(global_listener).to receive(:it_happened)
|
12
12
|
publisher.send(:broadcast, :it_happened)
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'works with options' do
|
16
16
|
Wisper::GlobalListeners.add(global_listener, :on => :it_happened,
|
17
17
|
:with => :woot)
|
18
|
-
global_listener.
|
19
|
-
global_listener.
|
18
|
+
expect(global_listener).to receive(:woot).once
|
19
|
+
expect(global_listener).not_to receive(:it_happened_again)
|
20
20
|
publisher.send(:broadcast, :it_happened)
|
21
21
|
publisher.send(:broadcast, :it_happened_again)
|
22
22
|
end
|
@@ -28,8 +28,8 @@ describe Wisper::GlobalListeners do
|
|
28
28
|
# local listener
|
29
29
|
publisher.add_listener(local_listener)
|
30
30
|
|
31
|
-
global_listener.
|
32
|
-
local_listener.
|
31
|
+
expect(global_listener).to receive(:it_happened)
|
32
|
+
expect(local_listener).to receive(:it_happened)
|
33
33
|
|
34
34
|
publisher.send(:broadcast, :it_happened)
|
35
35
|
end
|
@@ -42,9 +42,9 @@ describe Wisper::GlobalListeners do
|
|
42
42
|
Wisper::GlobalListeners.add(global_listener, :scope => [publisher_1.class,
|
43
43
|
publisher_2.class])
|
44
44
|
|
45
|
-
global_listener.
|
46
|
-
global_listener.
|
47
|
-
global_listener.
|
45
|
+
expect(global_listener).to receive(:it_happened_1).once
|
46
|
+
expect(global_listener).to receive(:it_happened_2).once
|
47
|
+
expect(global_listener).not_to receive(:it_happened_3)
|
48
48
|
|
49
49
|
publisher_1.send(:broadcast, :it_happened_1)
|
50
50
|
publisher_2.send(:broadcast, :it_happened_2)
|
@@ -60,18 +60,18 @@ describe Wisper::GlobalListeners do
|
|
60
60
|
end
|
61
61
|
end.each(&:join)
|
62
62
|
|
63
|
-
Wisper::GlobalListeners.listeners.size.
|
63
|
+
expect(Wisper::GlobalListeners.listeners.size).to eq num_threads
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
67
|
describe '.listeners' do
|
68
68
|
it 'returns collection of global listeners' do
|
69
69
|
Wisper::GlobalListeners.add(global_listener)
|
70
|
-
Wisper::GlobalListeners.listeners.
|
70
|
+
expect(Wisper::GlobalListeners.listeners).to eq [global_listener]
|
71
71
|
end
|
72
72
|
|
73
73
|
it 'returns an immutable collection' do
|
74
|
-
Wisper::GlobalListeners.listeners.
|
74
|
+
expect(Wisper::GlobalListeners.listeners).to be_frozen
|
75
75
|
expect { Wisper::GlobalListeners.listeners << global_listener }.to raise_error(RuntimeError)
|
76
76
|
end
|
77
77
|
end
|
@@ -79,14 +79,14 @@ describe Wisper::GlobalListeners do
|
|
79
79
|
it '.clear clears all global listeners' do
|
80
80
|
Wisper::GlobalListeners.add(global_listener)
|
81
81
|
Wisper::GlobalListeners.clear
|
82
|
-
Wisper::GlobalListeners.listeners.
|
82
|
+
expect(Wisper::GlobalListeners.listeners).to be_empty
|
83
83
|
end
|
84
84
|
|
85
85
|
describe 'backwards compatibility' do
|
86
86
|
it '.add_listener adds a listener' do
|
87
87
|
silence_warnings do
|
88
88
|
Wisper::GlobalListeners.add_listener(global_listener)
|
89
|
-
global_listener.
|
89
|
+
expect(global_listener).to receive(:it_happened)
|
90
90
|
publisher.send(:broadcast, :it_happened)
|
91
91
|
end
|
92
92
|
end
|
@@ -17,7 +17,7 @@ describe Wisper do
|
|
17
17
|
|
18
18
|
it 'subscribes object to all published events' do
|
19
19
|
listener = double('listener')
|
20
|
-
listener.
|
20
|
+
expect(listener).to receive(:success).with('hello')
|
21
21
|
|
22
22
|
command = MyCommand.new
|
23
23
|
|
@@ -28,7 +28,7 @@ describe Wisper do
|
|
28
28
|
|
29
29
|
it 'subscribes block to all published events' do
|
30
30
|
insider = double('Insider')
|
31
|
-
insider.
|
31
|
+
expect(insider).to receive(:render).with('hello')
|
32
32
|
|
33
33
|
command = MyCommand.new
|
34
34
|
|
@@ -42,8 +42,8 @@ describe Wisper do
|
|
42
42
|
it 'maps events to different methods' do
|
43
43
|
listener_1 = double('listener')
|
44
44
|
listener_2 = double('listener')
|
45
|
-
listener_1.
|
46
|
-
listener_2.
|
45
|
+
expect(listener_1).to receive(:happy_days).with('hello')
|
46
|
+
expect(listener_2).to receive(:sad_days).with('world')
|
47
47
|
|
48
48
|
command = MyCommand.new
|
49
49
|
|
@@ -57,8 +57,8 @@ describe Wisper do
|
|
57
57
|
it 'subscribes block can be chained' do
|
58
58
|
insider = double('Insider')
|
59
59
|
|
60
|
-
insider.
|
61
|
-
insider.
|
60
|
+
expect(insider).to receive(:render).with('success')
|
61
|
+
expect(insider).to receive(:render).with('failure')
|
62
62
|
|
63
63
|
command = MyCommand.new
|
64
64
|
|
@@ -13,8 +13,8 @@ end
|
|
13
13
|
describe 'simple publishing' do
|
14
14
|
it 'subscribes listener to events' do
|
15
15
|
listener = double('listener')
|
16
|
-
listener.
|
17
|
-
listener.
|
16
|
+
expect(listener).to receive(:foo).with instance_of MyPublisher
|
17
|
+
expect(listener).to receive(:bar).with instance_of MyPublisher
|
18
18
|
|
19
19
|
my_publisher = MyPublisher.new
|
20
20
|
my_publisher.add_listener(listener)
|
@@ -8,8 +8,8 @@ describe Wisper::TemporaryListeners do
|
|
8
8
|
describe '.with' do
|
9
9
|
it 'globally subscribes listener for duration of given block' do
|
10
10
|
|
11
|
-
listener_1.
|
12
|
-
listener_1.
|
11
|
+
expect(listener_1).to receive(:success)
|
12
|
+
expect(listener_1).to_not receive(:failure)
|
13
13
|
|
14
14
|
Wisper::TemporaryListeners.with(listener_1) do
|
15
15
|
publisher.instance_eval { broadcast(:success) }
|
@@ -20,11 +20,11 @@ describe Wisper::TemporaryListeners do
|
|
20
20
|
|
21
21
|
it 'globally subscribes listeners for duration of given block' do
|
22
22
|
|
23
|
-
listener_1.
|
24
|
-
listener_1.
|
23
|
+
expect(listener_1).to receive(:success)
|
24
|
+
expect(listener_1).to_not receive(:failure)
|
25
25
|
|
26
|
-
listener_2.
|
27
|
-
listener_2.
|
26
|
+
expect(listener_2).to receive(:success)
|
27
|
+
expect(listener_2).to_not receive(:failure)
|
28
28
|
|
29
29
|
Wisper::TemporaryListeners.with(listener_1, listener_2) do
|
30
30
|
publisher.instance_eval { broadcast(:success) }
|
@@ -38,11 +38,22 @@ describe Wisper::TemporaryListeners do
|
|
38
38
|
(1..num_threads).to_a.map do
|
39
39
|
Thread.new do
|
40
40
|
Wisper::TemporaryListeners.registrations << Object.new
|
41
|
-
Wisper::TemporaryListeners.registrations.size.
|
41
|
+
expect(Wisper::TemporaryListeners.registrations.size).to eql 1
|
42
42
|
end
|
43
43
|
end.each(&:join)
|
44
44
|
|
45
|
-
Wisper::TemporaryListeners.registrations.size.
|
45
|
+
expect(Wisper::TemporaryListeners.registrations.size).to eql 0
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'ensures registrations are cleared after exception raised in block' do
|
49
|
+
begin
|
50
|
+
Wisper::TemporaryListeners.with(listener_1) do
|
51
|
+
raise StandardError
|
52
|
+
end
|
53
|
+
rescue StandardError
|
54
|
+
end
|
55
|
+
|
56
|
+
expect(Wisper::TemporaryListeners.registrations.size).to eql 0
|
46
57
|
end
|
47
58
|
end
|
48
59
|
end
|
@@ -6,8 +6,8 @@ describe Wisper::Publisher do
|
|
6
6
|
|
7
7
|
describe '.add_listener' do
|
8
8
|
it 'subscribes given listener to all published events' do
|
9
|
-
listener.
|
10
|
-
listener.
|
9
|
+
expect(listener).to receive(:this_happened)
|
10
|
+
expect(listener).to receive(:so_did_this)
|
11
11
|
|
12
12
|
publisher.add_listener(listener)
|
13
13
|
|
@@ -17,11 +17,11 @@ describe Wisper::Publisher do
|
|
17
17
|
|
18
18
|
describe ':on argument' do
|
19
19
|
it 'subscribes given listener to a single event' do
|
20
|
-
listener.
|
21
|
-
listener.
|
22
|
-
listener.
|
20
|
+
expect(listener).to receive(:this_happened)
|
21
|
+
allow(listener).to receive(:so_did_this)
|
22
|
+
expect(listener).not_to receive(:so_did_this)
|
23
23
|
|
24
|
-
listener.
|
24
|
+
expect(listener).to respond_to(:so_did_this)
|
25
25
|
|
26
26
|
publisher.add_listener(listener, :on => 'this_happened')
|
27
27
|
|
@@ -30,12 +30,12 @@ describe Wisper::Publisher do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'subscribes given listener to many events' do
|
33
|
-
listener.
|
34
|
-
listener.
|
35
|
-
listener.
|
36
|
-
listener.
|
33
|
+
expect(listener).to receive(:this_happened)
|
34
|
+
expect(listener).to receive(:and_this)
|
35
|
+
allow(listener).to receive(:so_did_this)
|
36
|
+
expect(listener).not_to receive(:so_did_this)
|
37
37
|
|
38
|
-
listener.
|
38
|
+
expect(listener).to respond_to(:so_did_this)
|
39
39
|
|
40
40
|
publisher.add_listener(listener, :on => ['this_happened', 'and_this'])
|
41
41
|
|
@@ -47,7 +47,7 @@ describe Wisper::Publisher do
|
|
47
47
|
|
48
48
|
describe ':with argument' do
|
49
49
|
it 'sets method to call listener with on event' do
|
50
|
-
listener.
|
50
|
+
expect(listener).to receive(:different_method).twice
|
51
51
|
|
52
52
|
publisher.add_listener(listener, :with => :different_method)
|
53
53
|
|
@@ -58,8 +58,8 @@ describe Wisper::Publisher do
|
|
58
58
|
|
59
59
|
describe ':prefix argument' do
|
60
60
|
it 'prefixes broadcast events with given symbol' do
|
61
|
-
listener.
|
62
|
-
listener.
|
61
|
+
expect(listener).to receive(:after_it_happened)
|
62
|
+
expect(listener).not_to receive(:it_happened)
|
63
63
|
|
64
64
|
publisher.add_listener(listener, :prefix => :after)
|
65
65
|
|
@@ -67,8 +67,8 @@ describe Wisper::Publisher do
|
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'prefixes broadcast events with "on" when given true' do
|
70
|
-
listener.
|
71
|
-
listener.
|
70
|
+
expect(listener).to receive(:on_it_happened)
|
71
|
+
expect(listener).not_to receive(:it_happened)
|
72
72
|
|
73
73
|
publisher.add_listener(listener, :prefix => true)
|
74
74
|
|
@@ -79,23 +79,23 @@ describe Wisper::Publisher do
|
|
79
79
|
# NOTE: these are not realistic use cases, since you would only ever use
|
80
80
|
# `scope` when globally subscribing.
|
81
81
|
describe ':scope argument' do
|
82
|
-
let(:listener_1) {double('Listener')
|
83
|
-
let(:listener_2) {double('Listener')
|
82
|
+
let(:listener_1) { double('Listener') }
|
83
|
+
let(:listener_2) { double('Listener') }
|
84
84
|
|
85
85
|
before do
|
86
86
|
end
|
87
87
|
|
88
88
|
it 'scopes listener to given class' do
|
89
|
-
listener_1.
|
90
|
-
listener_2.
|
89
|
+
expect(listener_1).to receive(:it_happended)
|
90
|
+
expect(listener_2).not_to receive(:it_happended)
|
91
91
|
publisher.add_listener(listener_1, :scope => publisher.class)
|
92
92
|
publisher.add_listener(listener_2, :scope => Class.new)
|
93
93
|
publisher.send(:broadcast, 'it_happended')
|
94
94
|
end
|
95
95
|
|
96
96
|
it 'scopes listener to given class string' do
|
97
|
-
listener_1.
|
98
|
-
listener_2.
|
97
|
+
expect(listener_1).to receive(:it_happended)
|
98
|
+
expect(listener_2).not_to receive(:it_happended)
|
99
99
|
publisher.add_listener(listener_1, :scope => publisher.class.to_s)
|
100
100
|
publisher.add_listener(listener_2, :scope => Class.new.to_s)
|
101
101
|
publisher.send(:broadcast, 'it_happended')
|
@@ -106,7 +106,7 @@ describe Wisper::Publisher do
|
|
106
106
|
publisher_sub_klass = Class.new(publisher_super_klass)
|
107
107
|
|
108
108
|
listener = double('Listener')
|
109
|
-
listener.
|
109
|
+
expect(listener).to receive(:it_happended).once
|
110
110
|
|
111
111
|
publisher = publisher_sub_klass.new
|
112
112
|
|
@@ -116,11 +116,12 @@ describe Wisper::Publisher do
|
|
116
116
|
end
|
117
117
|
|
118
118
|
it 'returns publisher so methods can be chained' do
|
119
|
-
publisher.add_listener(listener, :on => 'so_did_this').
|
119
|
+
expect(publisher.add_listener(listener, :on => 'so_did_this')).to \
|
120
|
+
eq publisher
|
120
121
|
end
|
121
122
|
|
122
123
|
it 'is aliased to .subscribe' do
|
123
|
-
publisher.
|
124
|
+
expect(publisher).to respond_to(:subscribe)
|
124
125
|
end
|
125
126
|
end
|
126
127
|
|
@@ -128,7 +129,7 @@ describe Wisper::Publisher do
|
|
128
129
|
let(:insider) { double('insider') }
|
129
130
|
|
130
131
|
it 'subscribes given block to all events' do
|
131
|
-
insider.
|
132
|
+
expect(insider).to receive(:it_happened).twice
|
132
133
|
|
133
134
|
publisher.add_block_listener do
|
134
135
|
insider.it_happened
|
@@ -140,7 +141,7 @@ describe Wisper::Publisher do
|
|
140
141
|
|
141
142
|
describe ':on argument' do
|
142
143
|
it '.add_block_listener subscribes block to an event' do
|
143
|
-
insider.
|
144
|
+
expect(insider).not_to receive(:it_happened).once
|
144
145
|
|
145
146
|
publisher.add_block_listener(:on => 'something_happened') do
|
146
147
|
insider.it_happened
|
@@ -151,7 +152,7 @@ describe Wisper::Publisher do
|
|
151
152
|
end
|
152
153
|
|
153
154
|
it '.add_block_listener subscribes block to all listed events' do
|
154
|
-
insider.
|
155
|
+
expect(insider).to receive(:it_happened).twice
|
155
156
|
|
156
157
|
publisher.add_block_listener(
|
157
158
|
:on => ['something_happened', 'and_so_did_this']) do
|
@@ -165,8 +166,8 @@ describe Wisper::Publisher do
|
|
165
166
|
end
|
166
167
|
|
167
168
|
it 'returns publisher so methods can be chained' do
|
168
|
-
publisher.add_block_listener(:on => 'this_thing_happened') do
|
169
|
-
end.
|
169
|
+
expect(publisher.add_block_listener(:on => 'this_thing_happened') do
|
170
|
+
end).to eq publisher
|
170
171
|
end
|
171
172
|
end
|
172
173
|
|
@@ -174,7 +175,7 @@ describe Wisper::Publisher do
|
|
174
175
|
let(:insider) { double('insider') }
|
175
176
|
|
176
177
|
it 'subscribes given block to an event' do
|
177
|
-
insider.
|
178
|
+
expect(insider).to receive(:it_happened)
|
178
179
|
|
179
180
|
publisher.on(:something_happened) do
|
180
181
|
insider.it_happened
|
@@ -184,7 +185,7 @@ describe Wisper::Publisher do
|
|
184
185
|
end
|
185
186
|
|
186
187
|
it 'subscribes given block to multiple events' do
|
187
|
-
insider.
|
188
|
+
expect(insider).to receive(:it_happened).twice
|
188
189
|
|
189
190
|
publisher.on(:something_happened, :and_so_did_this) do
|
190
191
|
insider.it_happened
|
@@ -198,8 +199,8 @@ describe Wisper::Publisher do
|
|
198
199
|
|
199
200
|
describe '.broadcast' do
|
200
201
|
it 'does not publish events which cannot be responded to' do
|
201
|
-
listener.
|
202
|
-
listener.
|
202
|
+
expect(listener).not_to receive(:so_did_this)
|
203
|
+
allow(listener).to receive(:respond_to?).and_return(false)
|
203
204
|
|
204
205
|
publisher.add_listener(listener, :on => 'so_did_this')
|
205
206
|
|
@@ -208,7 +209,7 @@ describe Wisper::Publisher do
|
|
208
209
|
|
209
210
|
describe ':event argument' do
|
210
211
|
it 'is indifferent to string and symbol' do
|
211
|
-
listener.
|
212
|
+
expect(listener).to receive(:this_happened).twice
|
212
213
|
|
213
214
|
publisher.add_listener(listener)
|
214
215
|
|
@@ -217,7 +218,7 @@ describe Wisper::Publisher do
|
|
217
218
|
end
|
218
219
|
|
219
220
|
it 'is indifferent to dasherized and underscored strings' do
|
220
|
-
listener.
|
221
|
+
expect(listener).to receive(:this_happened).twice
|
221
222
|
|
222
223
|
publisher.add_listener(listener)
|
223
224
|
|
@@ -229,14 +230,14 @@ describe Wisper::Publisher do
|
|
229
230
|
|
230
231
|
describe '.listeners' do
|
231
232
|
it 'returns an immutable collection' do
|
232
|
-
publisher.listeners.
|
233
|
+
expect(publisher.listeners).to be_frozen
|
233
234
|
expect { publisher.listeners << listener }.to raise_error(RuntimeError)
|
234
235
|
end
|
235
236
|
|
236
237
|
it 'returns local listeners' do
|
237
238
|
publisher.add_listener(listener)
|
238
|
-
publisher.listeners.
|
239
|
-
publisher.listeners.size.
|
239
|
+
expect(publisher.listeners).to eq [listener]
|
240
|
+
expect(publisher.listeners.size).to eq 1
|
240
241
|
end
|
241
242
|
end
|
242
243
|
|
@@ -246,13 +247,13 @@ describe Wisper::Publisher do
|
|
246
247
|
|
247
248
|
it 'subscribes listeners to all instances of publisher' do
|
248
249
|
publisher_klass_1.add_listener(listener)
|
249
|
-
listener.
|
250
|
+
expect(listener).to receive(:it_happened).once
|
250
251
|
publisher_klass_1.new.send(:broadcast, 'it_happened')
|
251
252
|
publisher_klass_2.new.send(:broadcast, 'it_happened')
|
252
253
|
end
|
253
254
|
|
254
255
|
it 'is aliased to #subscribe' do
|
255
|
-
publisher_klass_1.
|
256
|
+
expect(publisher_klass_1).to respond_to(:subscribe)
|
256
257
|
end
|
257
258
|
end
|
258
259
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'wisper/rspec/matchers'
|
3
|
+
|
4
|
+
RSpec::configure do |config|
|
5
|
+
config.include(Wisper::RSpec::BroadcastMatcher)
|
6
|
+
end
|
7
|
+
|
8
|
+
describe 'broadcast matcher' do
|
9
|
+
it 'passes when publisher broadcasts inside block' do
|
10
|
+
publisher = publisher_class.new
|
11
|
+
expect { publisher.send(:broadcast, :foobar) }.to broadcast(:foobar)
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'passes with not_to when publisher does not broadcast inside block' do
|
15
|
+
publisher = publisher_class.new
|
16
|
+
expect { publisher }.not_to broadcast(:foobar)
|
17
|
+
end
|
18
|
+
end
|
@@ -1,7 +1,6 @@
|
|
1
|
-
require 'spec_helper'
|
2
1
|
require 'wisper/rspec/stub_wisper_publisher'
|
3
2
|
|
4
|
-
describe
|
3
|
+
describe '#stub_wisper_publisher' do
|
5
4
|
describe "given a piece of code invoking a publisher" do
|
6
5
|
class CodeThatReactsToEvents
|
7
6
|
def do_something
|
@@ -20,7 +19,7 @@ describe Wisper do
|
|
20
19
|
|
21
20
|
it "emits the event" do
|
22
21
|
response = CodeThatReactsToEvents.new.do_something
|
23
|
-
response.
|
22
|
+
expect(response).to eq "Hello with foo1 foo2!"
|
24
23
|
end
|
25
24
|
end
|
26
25
|
end
|
data/spec/lib/wisper_spec.rb
CHANGED
@@ -1,31 +1,82 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Wisper do
|
4
|
+
before do
|
5
|
+
# assign the stderr to a new StringIO to test errors
|
6
|
+
@orig_stderr, $stderr = $stderr, StringIO.new
|
7
|
+
end
|
8
|
+
|
9
|
+
after do
|
10
|
+
# reassign the stderr to the original <IO:<STDERR>> instead of StringIO
|
11
|
+
# used for testing
|
12
|
+
$stderr = @orig_stderr
|
13
|
+
end
|
4
14
|
|
5
15
|
it 'includes Wisper::Publisher for backwards compatibility' do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
16
|
+
publisher_class = Class.new { include Wisper }
|
17
|
+
expect(publisher_class.ancestors).to include Wisper::Publisher
|
18
|
+
|
19
|
+
$stderr.rewind
|
20
|
+
expect($stderr.gets.chomp).to include 'DEPRECATION'
|
10
21
|
end
|
11
22
|
|
23
|
+
# NOTE .with_listeners is deprecated
|
12
24
|
it '.with_listeners subscribes listeners to all broadcast events for the duration of block' do
|
13
25
|
publisher = publisher_class.new
|
14
26
|
listener = double('listener')
|
15
27
|
|
16
|
-
listener.should_receive(:im_here)
|
17
|
-
listener.should_not_receive(:not_here)
|
18
|
-
|
19
28
|
Wisper.with_listeners(listener) do
|
20
29
|
publisher.send(:broadcast, 'im_here')
|
21
30
|
end
|
22
31
|
|
23
|
-
|
32
|
+
$stderr.rewind
|
33
|
+
expect($stderr.string.chomp).to include 'DEPRECATION'
|
24
34
|
end
|
25
35
|
|
36
|
+
# NOTE .add_listener is deprecated
|
26
37
|
it '.add_listener adds a global listener' do
|
27
38
|
listener = double('listener')
|
39
|
+
|
28
40
|
Wisper.add_listener(listener)
|
29
|
-
|
41
|
+
|
42
|
+
$stderr.rewind
|
43
|
+
expect($stderr.string.chomp).to include 'DEPRECATION'
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '.subscribe' do
|
47
|
+
context 'given block' do
|
48
|
+
it 'subscribes listeners to all events for duration of the block' do
|
49
|
+
publisher = publisher_class.new
|
50
|
+
listener = double('listener')
|
51
|
+
|
52
|
+
expect(listener).to receive(:im_here)
|
53
|
+
expect(listener).not_to receive(:not_here)
|
54
|
+
|
55
|
+
Wisper.subscribe(listener) do
|
56
|
+
publisher.send(:broadcast, 'im_here')
|
57
|
+
end
|
58
|
+
|
59
|
+
publisher.send(:broadcast, 'not_here')
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'no block given' do
|
64
|
+
it 'subscribes a listener to all events' do
|
65
|
+
listener = double('listener')
|
66
|
+
Wisper.subscribe(listener)
|
67
|
+
expect(Wisper::GlobalListeners.listeners).to eq [listener]
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'subscribes multiple listeners to all events' do
|
71
|
+
listener_1 = double('listener')
|
72
|
+
listener_2 = double('listener')
|
73
|
+
listener_3 = double('listener')
|
74
|
+
|
75
|
+
Wisper.subscribe(listener_1, listener_2)
|
76
|
+
|
77
|
+
expect(Wisper::GlobalListeners.listeners).to include listener_1, listener_2
|
78
|
+
expect(Wisper::GlobalListeners.listeners).not_to include listener_3
|
79
|
+
end
|
80
|
+
end
|
30
81
|
end
|
31
82
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
SimpleCov.start
|
4
|
-
rescue LoadError
|
5
|
-
end
|
1
|
+
require 'coveralls'
|
2
|
+
Coveralls.wear!
|
6
3
|
|
7
4
|
require 'wisper'
|
8
5
|
|
@@ -12,13 +9,12 @@ RSpec.configure do |config|
|
|
12
9
|
config.order = 'random'
|
13
10
|
config.after(:each) { Wisper::GlobalListeners.clear }
|
14
11
|
|
15
|
-
# Support both Rspec2 should and Rspec3 expect syntax
|
16
12
|
config.expect_with :rspec do |c|
|
17
|
-
c.syntax =
|
13
|
+
c.syntax = :expect
|
18
14
|
end
|
19
15
|
|
20
16
|
config.mock_with :rspec do |c|
|
21
|
-
c.syntax =
|
17
|
+
c.syntax = :expect
|
22
18
|
end
|
23
19
|
end
|
24
20
|
|
data/wisper.gemspec
CHANGED
@@ -17,6 +17,4 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ["lib"]
|
20
|
-
|
21
|
-
gem.add_development_dependency 'rspec', "~> 3.0.0.beta1"
|
22
20
|
end
|
metadata
CHANGED
@@ -1,42 +1,31 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: wisper
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.4.0
|
6
5
|
platform: ruby
|
7
|
-
authors:
|
6
|
+
authors:
|
8
7
|
- Kris Leech
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 3.0.0.beta1
|
22
|
-
type: :development
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 3.0.0.beta1
|
11
|
+
|
12
|
+
date: 2014-09-08 00:00:00 Z
|
13
|
+
dependencies: []
|
14
|
+
|
30
15
|
description: pub/sub for Ruby objects
|
31
|
-
email:
|
16
|
+
email:
|
32
17
|
- kris.leech@gmail.com
|
33
18
|
executables: []
|
19
|
+
|
34
20
|
extensions: []
|
21
|
+
|
35
22
|
extra_rdoc_files: []
|
36
|
-
|
23
|
+
|
24
|
+
files:
|
37
25
|
- .gitignore
|
38
26
|
- .rspec
|
39
27
|
- .travis.yml
|
28
|
+
- CHANGELOG.md
|
40
29
|
- Gemfile
|
41
30
|
- Guardfile
|
42
31
|
- README.md
|
@@ -47,52 +36,55 @@ files:
|
|
47
36
|
- lib/wisper/registration/block.rb
|
48
37
|
- lib/wisper/registration/object.rb
|
49
38
|
- lib/wisper/registration/registration.rb
|
39
|
+
- lib/wisper/rspec/matchers.rb
|
50
40
|
- lib/wisper/rspec/stub_wisper_publisher.rb
|
51
41
|
- lib/wisper/temporary_listeners.rb
|
52
42
|
- lib/wisper/version.rb
|
53
43
|
- spec/lib/async_spec.rb
|
54
44
|
- spec/lib/global_subscribers_spec.rb
|
55
45
|
- spec/lib/integration_spec.rb
|
56
|
-
- spec/lib/rspec_extensions_spec.rb
|
57
46
|
- spec/lib/simple_example_spec.rb
|
58
47
|
- spec/lib/temporary_global_listeners_spec.rb
|
59
48
|
- spec/lib/wisper/publisher_spec.rb
|
49
|
+
- spec/lib/wisper/rspec/matchers_spec.rb
|
50
|
+
- spec/lib/wisper/rspec/stub_wisper_publisher_spec.rb
|
60
51
|
- spec/lib/wisper_spec.rb
|
61
52
|
- spec/spec_helper.rb
|
62
53
|
- wisper.gemspec
|
63
54
|
homepage: https://github.com/krisleech/wisper
|
64
|
-
licenses:
|
55
|
+
licenses:
|
65
56
|
- MIT
|
57
|
+
metadata: {}
|
58
|
+
|
66
59
|
post_install_message:
|
67
60
|
rdoc_options: []
|
68
|
-
|
61
|
+
|
62
|
+
require_paths:
|
69
63
|
- lib
|
70
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version:
|
76
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
-
|
78
|
-
|
79
|
-
- - ! '>='
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '0'
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- &id001
|
67
|
+
- ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: "0"
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- *id001
|
82
73
|
requirements: []
|
74
|
+
|
83
75
|
rubyforge_project:
|
84
|
-
rubygems_version:
|
76
|
+
rubygems_version: 2.2.2
|
85
77
|
signing_key:
|
86
|
-
specification_version:
|
78
|
+
specification_version: 4
|
87
79
|
summary: pub/sub for Ruby objects
|
88
|
-
test_files:
|
80
|
+
test_files:
|
89
81
|
- spec/lib/async_spec.rb
|
90
82
|
- spec/lib/global_subscribers_spec.rb
|
91
83
|
- spec/lib/integration_spec.rb
|
92
|
-
- spec/lib/rspec_extensions_spec.rb
|
93
84
|
- spec/lib/simple_example_spec.rb
|
94
85
|
- spec/lib/temporary_global_listeners_spec.rb
|
95
86
|
- spec/lib/wisper/publisher_spec.rb
|
87
|
+
- spec/lib/wisper/rspec/matchers_spec.rb
|
88
|
+
- spec/lib/wisper/rspec/stub_wisper_publisher_spec.rb
|
96
89
|
- spec/lib/wisper_spec.rb
|
97
90
|
- spec/spec_helper.rb
|
98
|
-
has_rdoc:
|