wisper-rspec 0.0.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -2
- data/CHANGELOG.md +6 -0
- data/Gemfile +6 -0
- data/README.md +3 -1
- data/bin/console +8 -0
- data/bin/setup +7 -0
- data/lib/wisper/rspec/matchers.rb +18 -0
- data/lib/wisper/rspec/version.rb +1 -1
- data/wisper-rspec.gemspec +0 -4
- metadata +8 -60
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b1ac40ea937039009a158c3753ab49b67c76767
|
4
|
+
data.tar.gz: 61834e51aea9764dce3d87e7a2f275e141444bae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8deacda13fe1165c845f806c5a1f4a08c4abfdd04c2f64118947a729f894c6323a2bea9fb9322ad50535c08d4b89c3ff1935b243d47b80978546e31fe0310925
|
7
|
+
data.tar.gz: 6bc43e47c5ab052c83a9f14a48f37d170a5c9d1530a84edfc0752a7b60d0b57ab8f9e6fa8b537a9a2debe8fe5f88e44e3182f144047ae939f4b06baf6ceaa04f
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -45,7 +45,7 @@ expect { publisher.execute }.to broadcast(:event, hash_including(a: 2))
|
|
45
45
|
```
|
46
46
|
|
47
47
|
Rspec values matcher can be used to match arguments. This assertion matches `broadcast(:another_event, a: 2, b: 1)` but not `broadcast(:another_event, a: 3)`
|
48
|
-
|
48
|
+
|
49
49
|
Matchers can be composed using [compound rspec matchers](http://www.rubydoc.info/gems/rspec-expectations/RSpec/Matchers/Composable):
|
50
50
|
|
51
51
|
```ruby
|
@@ -60,6 +60,8 @@ expect {
|
|
60
60
|
}.to broadcast(:event, 123).or broadcast(:event, 234)
|
61
61
|
```
|
62
62
|
|
63
|
+
Note that the `broadcast` method is aliased as `publish`, similar to the *Wisper* library itself.
|
64
|
+
|
63
65
|
### Using message expections
|
64
66
|
|
65
67
|
If you need to assert on the listener receiving broadcast arguments you can subscribe a double
|
data/bin/console
ADDED
data/bin/setup
ADDED
@@ -58,12 +58,28 @@ module Wisper
|
|
58
58
|
msg
|
59
59
|
end
|
60
60
|
|
61
|
+
def expected
|
62
|
+
[] << @args
|
63
|
+
end
|
64
|
+
|
65
|
+
def actual
|
66
|
+
broadcast_events_args
|
67
|
+
end
|
68
|
+
|
69
|
+
def diffable?
|
70
|
+
true
|
71
|
+
end
|
72
|
+
|
61
73
|
def failure_message_when_negated
|
62
74
|
msg = "expected publisher not to broadcast #{@event} event"
|
63
75
|
msg += " with args: #{@args.inspect}" if @args.size > 0
|
64
76
|
msg
|
65
77
|
end
|
66
78
|
|
79
|
+
def broadcast_events_args
|
80
|
+
@event_recorder.broadcast_events.map {|event| event.size == 1 ? [] : event[1..-1] }
|
81
|
+
end
|
82
|
+
|
67
83
|
def broadcast_events_list
|
68
84
|
if @event_recorder.broadcast_events.any?
|
69
85
|
" (actual events broadcast: #{event_names.join(', ')})"
|
@@ -84,6 +100,8 @@ module Wisper
|
|
84
100
|
def broadcast(event, *args)
|
85
101
|
Matcher.new(event, *args)
|
86
102
|
end
|
103
|
+
|
104
|
+
alias_method :publish, :broadcast
|
87
105
|
end
|
88
106
|
end
|
89
107
|
|
data/lib/wisper/rspec/version.rb
CHANGED
data/wisper-rspec.gemspec
CHANGED
@@ -18,8 +18,4 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency 'wisper'
|
22
|
-
spec.add_development_dependency 'rspec'
|
23
|
-
spec.add_development_dependency 'bundler'
|
24
|
-
spec.add_development_dependency 'rake'
|
25
21
|
end
|
metadata
CHANGED
@@ -1,75 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wisper-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kris Leech
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: wisper
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rspec
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: bundler
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rake
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
11
|
+
date: 2017-09-16 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
69
13
|
description: Rspec matchers and stubbing for Wisper
|
70
14
|
email:
|
71
15
|
- kris.leech@gmail.com
|
72
|
-
executables:
|
16
|
+
executables:
|
17
|
+
- console
|
18
|
+
- setup
|
73
19
|
extensions: []
|
74
20
|
extra_rdoc_files: []
|
75
21
|
files:
|
@@ -82,6 +28,8 @@ files:
|
|
82
28
|
- LICENSE.txt
|
83
29
|
- README.md
|
84
30
|
- Rakefile
|
31
|
+
- bin/console
|
32
|
+
- bin/setup
|
85
33
|
- lib/wisper/rspec.rb
|
86
34
|
- lib/wisper/rspec/matchers.rb
|
87
35
|
- lib/wisper/rspec/stub_wisper_publisher.rb
|