multiple_man 0.5.11 → 0.5.13

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: e67a4986fcfa2f58d6e05f8b00948c36380545e8
4
- data.tar.gz: 2d0c3ed94090f760a86f94fd0972fc9b21fbf7af
3
+ metadata.gz: 10e7776ff5f12168fa8984908248adbfc9b5217c
4
+ data.tar.gz: 13d0b1dc30ebc18767f44c0289130878711291f8
5
5
  SHA512:
6
- metadata.gz: b72667abc2681f98488a3c6acc3ec8647d81330c20c812304c03e7ba949179a3b41cb6c194f0467aa9073fc32246c9af0ef659566dd515f9f9d9db70f8f1cc2e
7
- data.tar.gz: fbc00833e9173673a322465d1c635ca5d56763d7766be5fef8120421f3f7a47a5da38a4d229b81b1755aac7c8a5bc933172b55b785045b14e61a24227150a59d
6
+ metadata.gz: c6bdb87677e72708e57454f741b437775b564e45ffc7f01d5de40843f0b8516e616007eae9ce3c8976cf3818ed3d8a750d90c6209eef36a3d209c45fc144c9af
7
+ data.tar.gz: f1518798dd88109dce33f893229171fb9e6bbae538a9097497c6d60cbf3271be17bc623ec621960c50c13fc58de49a0873c520976ae8a04dd58df5d84f2f55db
@@ -21,10 +21,14 @@ module MultipleMan
21
21
  end
22
22
 
23
23
  def self.connect
24
- channel = connection.create_channel
24
+ channel = nil
25
+ connection = self.connection
26
+ @mutex.synchronize do
27
+ channel = connection.create_channel
28
+ end
25
29
  yield new(channel) if block_given?
26
30
  ensure
27
- channel.close if channel
31
+ channel.close if channel && channel.open?
28
32
  end
29
33
 
30
34
  attr_reader :topic
@@ -1,3 +1,3 @@
1
1
  module MultipleMan
2
- VERSION = "0.5.11"
2
+ VERSION = "0.5.13"
3
3
  end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe MultipleMan::Connection do
4
4
 
5
5
  let(:mock_bunny) { double(Bunny) }
6
- let(:mock_channel) { double(Bunny::Channel, close: nil) }
6
+ let(:mock_channel) { double(Bunny::Channel, close: nil, open?: true, topic: nil) }
7
7
 
8
8
  describe "connect" do
9
9
  it "should open a connection and a channel" do
@@ -40,7 +40,7 @@ describe MultipleMan::RoutingKey do
40
40
  end
41
41
 
42
42
  describe "operation=" do
43
- [:create, :update, :destroy, :"#"].each do |op|
43
+ [:create, :update, :destroy, :"#", "create"].each do |op|
44
44
  it "should allow #{op}" do
45
45
  rk = described_class.new(Object)
46
46
  rk.operation = op
@@ -48,7 +48,7 @@ describe MultipleMan::RoutingKey do
48
48
  end
49
49
  end
50
50
 
51
- ["new", nil, "", "create"].each do |op|
51
+ ["new", nil, ""].each do |op|
52
52
  it "should not allow #{op}" do
53
53
  rk = described_class.new(Object)
54
54
  expect { rk.operation = op }.to raise_error
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multiple_man
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.11
4
+ version: 0.5.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Brunner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-24 00:00:00.000000000 Z
11
+ date: 2014-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler