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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 643aca16e7e08f43376f456256d0cfc5a4cb2621
4
- data.tar.gz: aee3c2ee2e11a253f1dae2796340e0e8ed5474de
3
+ metadata.gz: 7b1ac40ea937039009a158c3753ab49b67c76767
4
+ data.tar.gz: 61834e51aea9764dce3d87e7a2f275e141444bae
5
5
  SHA512:
6
- metadata.gz: 3f0b3ed5f0bbccbd7ab38de8d59985d5f60ade1dad5990fd57886c0e5401ee45ab2b2bcb55d08516b47c8dfe3ed19f039c4e736e56e5f2639d33a3ca87443cd8
7
- data.tar.gz: 9d06774d7b55f981b1e908fdb61618fab9af01a006c10864fc9f72afcde01f4c353d1526264ce8bfd25af79da9637f4acf0c2b9436b9b8cadf334319b334f2e1
6
+ metadata.gz: 8deacda13fe1165c845f806c5a1f4a08c4abfdd04c2f64118947a729f894c6323a2bea9fb9322ad50535c08d4b89c3ff1935b243d47b80978546e31fe0310925
7
+ data.tar.gz: 6bc43e47c5ab052c83a9f14a48f37d170a5c9d1530a84edfc0752a7b60d0b57ab8f9e6fa8b537a9a2debe8fe5f88e44e3182f144047ae939f4b06baf6ceaa04f
@@ -4,5 +4,4 @@ before_install:
4
4
  - gem install bundler
5
5
  script: rspec spec
6
6
  rvm:
7
- - '1.9.3'
8
- - '2.1.2'
7
+ - '2.4.0'
@@ -1,3 +1,9 @@
1
+ 1.0.0 (16/Sept/2017)
2
+
3
+ Authors: Adis Osmonov (adisos)
4
+
5
+ * Matchers shows diff when expectation fails #18
6
+
1
7
  0.0.3 (7/Mar/2017)
2
8
 
3
9
  0.0.2 (8/Jan/2015)
data/Gemfile CHANGED
@@ -1,3 +1,9 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ gem 'wisper'
6
+ gem 'rspec'
7
+ gem 'pry-byebug'
8
+ gem 'bundler'
9
+ gem 'rake'
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
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "wisper/rspec"
5
+ require 'wisper/rspec/matchers'
6
+
7
+ require "pry"
8
+ Pry.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  module Wisper
2
2
  module Rspec
3
- VERSION = "0.0.3"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
@@ -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.3
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-03-07 00:00:00.000000000 Z
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