rx-rspec 0.1.1 → 0.1.3

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: f6507c53feee706f281f8077a6ccc6abb757b237
4
- data.tar.gz: 8cd2b5dbcaa43a217e19515fed6413bc220181d3
3
+ metadata.gz: 4d04c7319d97b9aa65068cc6128a4d2f4981083c
4
+ data.tar.gz: ad2c11c3cbbff7fddcaafa6b78095b0ef0d01163
5
5
  SHA512:
6
- metadata.gz: 9a7b1301ff7b25c0f2dda07b40016d436ebf1323a1d20c52a7dfa694f12e3bfebe1daa5221af7d7304a352623f4c3b2e443f6d670a0ecb32d71675dced69c50c
7
- data.tar.gz: 29e1f358941a59f34f8f103ac0214bb8957d36bc47d75650767647646737d885d83443d0022a69c0541dea2da1ec1742dee861794f95e5b839855b81ab7f943d
6
+ metadata.gz: fd7053d1a53726b682e5ed047ded7a9e79429d7bfa1976e7f0c68458ec1b0ea3cb874954a2f8bfd9f0bf2922efe93319a4f76e1b7b9e105d3eb1f0cf211e21c8
7
+ data.tar.gz: 60ffe9b2d84ae7291bc4379416b9f70df3bf12798592190548e4c1b5f27df1e9f8c1135738b24dacacaf2aa66d40eb408a6535ecc1c88df6821396b65449e7cd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rx-rspec (0.1.1)
4
+ rx-rspec (0.1.3)
5
5
  rx
6
6
 
7
7
  GEM
@@ -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.subscribe_on_error { |err| errors << err }
11
- subscription = actual.delay(0).subscribe(
12
- lambda do |event|
13
- events << event
14
- idx = expected.index { |exp| values_match?(exp, event) }
15
- expected.delete_at(idx) unless idx.nil?
16
- subscription.unsubscribe if expected.empty?
17
- end,
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.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.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-04 00:00:00.000000000 Z
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