em-spec 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,13 +6,13 @@ Gem::Specification.new do |s|
6
6
  s.name = 'em-spec'
7
7
  s.version = EventMachine::Spec::VERSION
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
- s.authors = ["Aman Gupta"]
9
+ s.authors = ["Aman Gupta", "Julien Ammous"]
10
10
  s.summary = "Simple BDD API for testing asynchronous Ruby/EventMachine code"
11
11
  s.description = "Simple BDD API for testing asynchronous Ruby/EventMachine code"
12
- s.email = %q{aman@tmm1.net}
12
+ s.email = %q{schmurfy@gmail.com}
13
13
  s.extra_rdoc_files = ['README.rdoc']
14
14
  s.files = `git ls-files`.split("\n")
15
- s.homepage = %q{http://github.com/joshbuddy/em-spec}
15
+ s.homepage = %q{http://github.com/schmurfy/em-spec}
16
16
  s.rdoc_options = ["--charset=UTF-8"]
17
17
  s.require_paths = ["lib"]
18
18
  s.rubygems_version = %q{1.3.7}
@@ -74,6 +74,13 @@ class Bacon::FiberedContext < Bacon::Context
74
74
  end
75
75
  }
76
76
  end
77
+
78
+ def describe(*args, &block)
79
+ context = Bacon::FiberedContext.new(args.join(' '), &block)
80
+ @before.each { |b| context.before(&b) }
81
+ @after.each { |b| context.after(&b) }
82
+ context.run
83
+ end
77
84
 
78
85
  def done(succeed = true)
79
86
  cancel_timer
@@ -21,9 +21,10 @@ module EventMachine
21
21
  end
22
22
 
23
23
  def em(time_to_run = @@_em_default_time_to_finish, &block)
24
+ em_spec_exception = nil
25
+
24
26
  EM.run do
25
27
  timeout(time_to_run) if time_to_run
26
- em_spec_exception = nil
27
28
  @_em_spec_fiber = Fiber.new do
28
29
  begin
29
30
  block.call
@@ -34,9 +35,9 @@ module EventMachine
34
35
  end
35
36
 
36
37
  @_em_spec_fiber.resume
37
-
38
- raise em_spec_exception if em_spec_exception
39
38
  end
39
+
40
+ raise em_spec_exception if em_spec_exception
40
41
  end
41
42
 
42
43
  def done
@@ -1,5 +1,5 @@
1
1
  module EventMachine
2
2
  module Spec
3
- VERSION = '0.2.4'
3
+ VERSION = '0.2.5'
4
4
  end
5
5
  end
@@ -43,6 +43,24 @@ EM.describe EventMachine do
43
43
  done
44
44
  }
45
45
  end
46
+
47
+ describe 'subscope' do
48
+ should 'works here' do
49
+ i_did_it = false
50
+
51
+ fib = Fiber.current
52
+
53
+ EM.add_timer(0.1){
54
+ i_did_it = true
55
+ fib.resume
56
+ }
57
+
58
+ Fiber.yield
59
+
60
+ i_did_it.should == true
61
+ proc{ done }.should.not.raise(NameError)
62
+ end
63
+ end
46
64
 
47
65
  # it "should not block on failure" do
48
66
  # 1.should == 2
metadata CHANGED
@@ -1,26 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-spec
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 4
10
- version: 0.2.4
9
+ - 5
10
+ version: 0.2.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Aman Gupta
14
+ - Julien Ammous
14
15
  autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2011-08-07 00:00:00 -07:00
19
+ date: 2011-08-11 00:00:00 -07:00
19
20
  default_executable:
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
23
+ name: rspec
22
24
  prerelease: false
23
- version_requirements: &id001 !ruby/object:Gem::Requirement
25
+ requirement: &id001 !ruby/object:Gem::Requirement
24
26
  none: false
25
27
  requirements:
26
28
  - - ~>
@@ -31,12 +33,12 @@ dependencies:
31
33
  - 6
32
34
  - 0
33
35
  version: 2.6.0
34
- requirement: *id001
35
- name: rspec
36
36
  type: :runtime
37
+ version_requirements: *id001
37
38
  - !ruby/object:Gem::Dependency
39
+ name: bacon
38
40
  prerelease: false
39
- version_requirements: &id002 !ruby/object:Gem::Requirement
41
+ requirement: &id002 !ruby/object:Gem::Requirement
40
42
  none: false
41
43
  requirements:
42
44
  - - ">="
@@ -45,12 +47,12 @@ dependencies:
45
47
  segments:
46
48
  - 0
47
49
  version: "0"
48
- requirement: *id002
49
- name: bacon
50
50
  type: :runtime
51
+ version_requirements: *id002
51
52
  - !ruby/object:Gem::Dependency
53
+ name: test-unit
52
54
  prerelease: false
53
- version_requirements: &id003 !ruby/object:Gem::Requirement
55
+ requirement: &id003 !ruby/object:Gem::Requirement
54
56
  none: false
55
57
  requirements:
56
58
  - - ">="
@@ -59,12 +61,12 @@ dependencies:
59
61
  segments:
60
62
  - 0
61
63
  version: "0"
62
- requirement: *id003
63
- name: test-unit
64
64
  type: :runtime
65
+ version_requirements: *id003
65
66
  - !ruby/object:Gem::Dependency
67
+ name: eventmachine
66
68
  prerelease: false
67
- version_requirements: &id004 !ruby/object:Gem::Requirement
69
+ requirement: &id004 !ruby/object:Gem::Requirement
68
70
  none: false
69
71
  requirements:
70
72
  - - ">="
@@ -73,12 +75,12 @@ dependencies:
73
75
  segments:
74
76
  - 0
75
77
  version: "0"
76
- requirement: *id004
77
- name: eventmachine
78
78
  type: :runtime
79
+ version_requirements: *id004
79
80
  - !ruby/object:Gem::Dependency
81
+ name: growl
80
82
  prerelease: false
81
- version_requirements: &id005 !ruby/object:Gem::Requirement
83
+ requirement: &id005 !ruby/object:Gem::Requirement
82
84
  none: false
83
85
  requirements:
84
86
  - - ">="
@@ -87,12 +89,12 @@ dependencies:
87
89
  segments:
88
90
  - 0
89
91
  version: "0"
90
- requirement: *id005
91
- name: growl
92
92
  type: :development
93
+ version_requirements: *id005
93
94
  - !ruby/object:Gem::Dependency
95
+ name: guard-rspec
94
96
  prerelease: false
95
- version_requirements: &id006 !ruby/object:Gem::Requirement
97
+ requirement: &id006 !ruby/object:Gem::Requirement
96
98
  none: false
97
99
  requirements:
98
100
  - - ">="
@@ -101,12 +103,12 @@ dependencies:
101
103
  segments:
102
104
  - 0
103
105
  version: "0"
104
- requirement: *id006
105
- name: guard-rspec
106
106
  type: :development
107
+ version_requirements: *id006
107
108
  - !ruby/object:Gem::Dependency
109
+ name: guard-bundler
108
110
  prerelease: false
109
- version_requirements: &id007 !ruby/object:Gem::Requirement
111
+ requirement: &id007 !ruby/object:Gem::Requirement
110
112
  none: false
111
113
  requirements:
112
114
  - - ">="
@@ -115,12 +117,12 @@ dependencies:
115
117
  segments:
116
118
  - 0
117
119
  version: "0"
118
- requirement: *id007
119
- name: guard-bundler
120
120
  type: :development
121
+ version_requirements: *id007
121
122
  - !ruby/object:Gem::Dependency
123
+ name: rake
122
124
  prerelease: false
123
- version_requirements: &id008 !ruby/object:Gem::Requirement
125
+ requirement: &id008 !ruby/object:Gem::Requirement
124
126
  none: false
125
127
  requirements:
126
128
  - - "="
@@ -131,11 +133,10 @@ dependencies:
131
133
  - 8
132
134
  - 7
133
135
  version: 0.8.7
134
- requirement: *id008
135
- name: rake
136
136
  type: :development
137
+ version_requirements: *id008
137
138
  description: Simple BDD API for testing asynchronous Ruby/EventMachine code
138
- email: aman@tmm1.net
139
+ email: schmurfy@gmail.com
139
140
  executables: []
140
141
 
141
142
  extensions: []
@@ -161,7 +162,7 @@ files:
161
162
  - test/bacon_spec.rb
162
163
  - test/test_spec.rb
163
164
  has_rdoc: true
164
- homepage: http://github.com/joshbuddy/em-spec
165
+ homepage: http://github.com/schmurfy/em-spec
165
166
  licenses: []
166
167
 
167
168
  post_install_message: