amqp-spec 0.1.12 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY CHANGED
@@ -57,3 +57,7 @@
57
57
  == 0.1.12 / 2010-10-18
58
58
 
59
59
  * README extended
60
+
61
+ == 0.1.13 / 2010-10-23
62
+
63
+ * Release
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.12
1
+ 0.1.13
@@ -20,16 +20,12 @@ context 'Following examples should all be failing:' do
20
20
 
21
21
  include AMQP::EMSpec
22
22
  it 'should timeout before reaching done' do
23
- EM.add_timer(2) {
24
- done
25
- }
23
+ EM.add_timer(2) { done }
26
24
  end
27
25
 
28
26
  it 'should timeout before reaching done' do
29
27
  timeout(0.3)
30
- EM.add_timer(0.6) {
31
- done
32
- }
28
+ EM.add_timer(0.6) { done }
33
29
  end
34
30
  end
35
31
 
@@ -37,19 +33,15 @@ context 'Following examples should all be failing:' do
37
33
 
38
34
  include AMQP::Spec
39
35
 
40
- default_timeout 1
36
+ default_timeout 1 # Because we may need to run this spec file separately
41
37
 
42
38
  it 'should timeout before reaching done' do
43
- EM.add_timer(2) {
44
- done
45
- }
39
+ EM.add_timer(2) { done }
46
40
  end
47
41
 
48
42
  it 'should timeout before reaching done' do
49
43
  timeout(0.2)
50
- EM.add_timer(0.5) {
51
- done
52
- }
44
+ EM.add_timer(0.5) { done }
53
45
  end
54
46
 
55
47
  it 'should fail due to timeout, not hang up' do
@@ -51,21 +51,21 @@ context 'Evented AMQP specs' do
51
51
  include AMQP::SpecHelper
52
52
 
53
53
  it "bubbles failing expectations up to Rspec" do
54
- proc {
54
+ expect {
55
55
  amqp do
56
56
  :this.should == :fail
57
57
  end
58
- }.should raise_error Spec::Expectations::ExpectationNotMetError
58
+ }.to raise_error Spec::Expectations::ExpectationNotMetError
59
59
  AMQP.conn.should == nil
60
60
  end
61
61
 
62
62
  it "should NOT ignore failing expectations after 'done'" do
63
- proc {
63
+ expect {
64
64
  amqp do
65
65
  done
66
66
  :this.should == :fail
67
67
  end
68
- }.should raise_error Spec::Expectations::ExpectationNotMetError
68
+ }.to raise_error Spec::Expectations::ExpectationNotMetError
69
69
  AMQP.conn.should == nil
70
70
  end
71
71
 
@@ -77,11 +77,11 @@ context 'Evented AMQP specs' do
77
77
  describe 'MQ', " when MQ.queue/fanout/topic tries to access Thread.current[:mq] across examples" do
78
78
  include AMQP::SpecHelper
79
79
 
80
- it 'sends data to queue' do
80
+ it 'sends data to the queue' do
81
81
  publish_and_consume_once
82
82
  end
83
83
 
84
- it 'sends data to queue, again' do
84
+ it 'does not hang sending data to the same queue, again' do
85
85
  publish_and_consume_once
86
86
  end
87
87
 
@@ -9,9 +9,8 @@ context 'Plain EM, no AMQP' do
9
9
  end
10
10
 
11
11
  it "should have timers" do
12
+ start = Time.now
12
13
  em do
13
- start = Time.now
14
-
15
14
  EM.add_timer(0.5) {
16
15
  (Time.now-start).should be_close(0.5, 0.1)
17
16
  done
@@ -21,27 +20,21 @@ context 'Plain EM, no AMQP' do
21
20
 
22
21
  it "should be possible to set spec timeouts as a number of secounds" do
23
22
  start = Time.now
24
- proc {
23
+ expect {
25
24
  em(0.5) do
26
-
27
- EM.add_timer(1) {
28
- done
29
- }
25
+ EM.add_timer(1) { done }
30
26
  end
31
- }.should raise_error SpecTimeoutExceededError
27
+ }.to raise_error SpecTimeoutExceededError
32
28
  (Time.now-start).should be_close(0.5, 0.1)
33
29
  end
34
30
 
35
31
  it "should be possible to set spec timeout as an option (amqp interface compatibility)" do
36
32
  start = Time.now
37
- proc {
33
+ expect {
38
34
  em(0.5) do
39
-
40
- EM.add_timer(1) {
41
- done
42
- }
35
+ EM.add_timer(1) { done }
43
36
  end
44
- }.should raise_error SpecTimeoutExceededError
37
+ }.to raise_error SpecTimeoutExceededError
45
38
  (Time.now-start).should be_close(0.5, 0.1)
46
39
  end
47
40
  end
@@ -50,7 +43,6 @@ context 'Plain EM, no AMQP' do
50
43
  include AMQP::EMSpec
51
44
 
52
45
  it_should_behave_like 'Spec examples'
53
-
54
46
  end
55
47
  end
56
48
 
@@ -1,5 +1,5 @@
1
1
  shared_examples_for 'SpecHelper examples' do
2
- after(:each) do
2
+ after do
3
3
  EM.reactor_running?.should == false
4
4
  AMQP.conn.should be_nil
5
5
  end
@@ -9,15 +9,12 @@ shared_examples_for 'SpecHelper examples' do
9
9
  end
10
10
 
11
11
  it "should properly work" do
12
- amqp do
13
- done
14
- end
12
+ amqp { done}
15
13
  end
16
14
 
17
15
  it "should have timers" do
16
+ start = Time.now
18
17
  amqp do
19
- start = Time.now
20
-
21
18
  EM.add_timer(0.5) {
22
19
  (Time.now-start).should be_close(0.5, 0.1)
23
20
  done
@@ -51,12 +48,12 @@ shared_examples_for 'SpecHelper examples' do
51
48
  end
52
49
 
53
50
  it "should gracefully exit if no AMQP connection was made" do
54
- proc {
51
+ expect {
55
52
  amqp(:host => 'Impossible') do
56
53
  AMQP.conn.should be_nil
57
54
  done
58
55
  end
59
- }.should raise_error EventMachine::ConnectionError
56
+ }.to raise_error EventMachine::ConnectionError
60
57
  AMQP.conn.should be_nil
61
58
  end
62
59
 
@@ -65,7 +62,7 @@ shared_examples_for 'SpecHelper examples' do
65
62
  end
66
63
 
67
64
  shared_examples_for 'Spec examples' do
68
- after(:each) do
65
+ after do
69
66
  EM.reactor_running?.should == true
70
67
  # AMQP.conn.should be_nil # You're inside running amqp block, stupid!
71
68
  done
@@ -143,38 +140,33 @@ end
143
140
 
144
141
 
145
142
  shared_examples_for 'timeout examples' do
146
- before(:each) { @start = Time.now }
143
+ before { @start = Time.now }
147
144
 
148
145
  it 'should timeout before reaching done because of default spec timeout' do
149
- proc {
150
- amqp do
151
- EM.add_timer(2) { done }
152
- end
153
- }.should raise_error SpecTimeoutExceededError
146
+ expect { amqp { EM.add_timer(2) { done } } }.
147
+ to raise_error SpecTimeoutExceededError
154
148
  (Time.now-@start).should be_close(1.0, 0.1)
155
149
  end
156
150
 
157
151
  it 'should timeout before reaching done because of explicit in-loop timeout' do
158
- proc {
152
+ expect {
159
153
  amqp do
160
154
  timeout(0.2)
161
155
  EM.add_timer(0.5) { done }
162
156
  end
163
- }.should raise_error SpecTimeoutExceededError
157
+ }.to raise_error SpecTimeoutExceededError
164
158
  (Time.now-@start).should be_close(0.2, 0.1)
165
159
  end
166
160
 
167
161
  specify "spec timeout given in amqp options has higher priority than default" do
168
- proc {
169
- amqp(:spec_timeout => 0.2) {}
170
- }.should raise_error SpecTimeoutExceededError
162
+ expect { amqp(:spec_timeout => 0.2) {} }.
163
+ to raise_error SpecTimeoutExceededError
171
164
  (Time.now-@start).should be_close(0.2, 0.1)
172
165
  end
173
166
 
174
167
  specify "but timeout call inside amqp loop has even higher priority" do
175
- proc {
176
- amqp(:spec_timeout => 0.5) { timeout(0.2) }
177
- }.should raise_error SpecTimeoutExceededError
168
+ expect { amqp(:spec_timeout => 0.5) { timeout(0.2) } }.
169
+ to raise_error SpecTimeoutExceededError
178
170
  (Time.now-@start).should be_close(0.2, 0.1)
179
171
  end
180
172
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amqp-spec
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 12
10
- version: 0.1.12
9
+ - 13
10
+ version: 0.1.13
11
11
  platform: ruby
12
12
  authors:
13
13
  - Arvicco
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-18 00:00:00 +04:00
18
+ date: 2010-10-23 00:00:00 +04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency