em-spec-helpers 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ em-spec-helpers
2
+ ===============
3
+
4
+ Helpers for writing RSpec examples for EventMachine-based code.
5
+
6
+ Rather minimal at present, but plan to put more helpers here. Testing async
7
+ code should be (almost) as easy as testing synchronous code!
@@ -0,0 +1,3 @@
1
+ require 'eventmachine'
2
+
3
+ require File.join(File.dirname(__FILE__), 'em', 'spec_helpers')
@@ -0,0 +1,20 @@
1
+ module EM
2
+ def self.with_all_ticks
3
+ EM::run do
4
+ yield
5
+ stop_after_all_ticks
6
+ end
7
+ end
8
+
9
+ def self.run_all_ticks
10
+ EM::run{ stop_after_all_ticks }
11
+ end
12
+
13
+ def self.stop_after_all_ticks
14
+ if @next_tick_queue && !@next_tick_queue.empty?
15
+ EM::next_tick{ stop_after_all_ticks }
16
+ else
17
+ EM::stop
18
+ end
19
+ end
20
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: em-spec-helpers
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Sam Stokes
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-28 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: eventmachine
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rspec
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: ! 'Helpers for writing RSpec examples for EventMachine-based code.
47
+
48
+ '
49
+ email:
50
+ - sam@rapportive.com
51
+ executables: []
52
+ extensions: []
53
+ extra_rdoc_files: []
54
+ files:
55
+ - lib/em/spec_helpers.rb
56
+ - lib/em-spec-helpers.rb
57
+ - README.md
58
+ homepage: https://github.com/rapportive/em-spec-helpers
59
+ licenses: []
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 1.8.19
79
+ signing_key:
80
+ specification_version: 3
81
+ summary: Helpers for writing RSpec examples for EventMachine-based code.
82
+ test_files: []
83
+ has_rdoc: