rx-rspec 0.1.1 → 0.1.3
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rx-rspec/matchers.rb +13 -9
- data/lib/rx-rspec.rb +1 -0
- data/rx-rspec.gemspec +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d04c7319d97b9aa65068cc6128a4d2f4981083c
|
4
|
+
data.tar.gz: ad2c11c3cbbff7fddcaafa6b78095b0ef0d01163
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd7053d1a53726b682e5ed047ded7a9e79429d7bfa1976e7f0c68458ec1b0ea3cb874954a2f8bfd9f0bf2922efe93319a4f76e1b7b9e105d3eb1f0cf211e21c8
|
7
|
+
data.tar.gz: 60ffe9b2d84ae7291bc4379416b9f70df3bf12798592190548e4c1b5f27df1e9f8c1135738b24dacacaf2aa66d40eb408a6535ecc1c88df6821396b65449e7cd
|
data/Gemfile.lock
CHANGED
data/lib/rx-rspec/matchers.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
|
3
|
+
# TODO:
|
4
|
+
# - should have specific timeout message 'x seconds waiting for y'
|
5
|
+
|
1
6
|
RSpec::Matchers.define :emit_include do |*expected|
|
2
7
|
events = []
|
3
8
|
errors = []
|
@@ -7,15 +12,14 @@ RSpec::Matchers.define :emit_include do |*expected|
|
|
7
12
|
expected = expected.dup
|
8
13
|
Thread.new do
|
9
14
|
deadline = Time.now + 0.5
|
10
|
-
actual.
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
lambda {}, # Seems we cannot get here
|
15
|
+
actual.take_while do |event|
|
16
|
+
events << event
|
17
|
+
idx = expected.index { |exp| values_match?(exp, event) }
|
18
|
+
expected.delete_at(idx) unless idx.nil?
|
19
|
+
expected.size > 0
|
20
|
+
end.subscribe(
|
21
|
+
lambda { |event| },
|
22
|
+
lambda { |err| errors << err },
|
19
23
|
lambda { completed << :complete }
|
20
24
|
)
|
21
25
|
|
data/lib/rx-rspec.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'rx-rspec/matchers'
|
data/rx-rspec.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'rx-rspec'
|
3
|
-
spec.version = '0.1.
|
3
|
+
spec.version = '0.1.3'
|
4
4
|
spec.summary = 'rspec testing support for RxRuby'
|
5
5
|
spec.description = 'Writing specs for reactive streams is tricky both because of their asynchronous nature and because their next/error/completed semantics. The goal of rx-rspec is to provide powerful matchers that lets you express your expectations in a traditional rspec-like synchronous manner.'
|
6
6
|
spec.authors = ['Anders Qvist']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rx-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anders Qvist
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rx
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- Gemfile.lock
|
110
110
|
- LICENSE.md
|
111
111
|
- README.md
|
112
|
+
- lib/rx-rspec.rb
|
112
113
|
- lib/rx-rspec/matchers.rb
|
113
114
|
- rx-rspec.gemspec
|
114
115
|
homepage: http://github.org/bittrance/rx-rspec
|