multiple_man 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 281afe83885726b5605460d6ca767b02533a46bb
4
- data.tar.gz: 2c039313e01e5e55085061de80023d835bdfb3d2
3
+ metadata.gz: 27a4153d5c70fd0caf82e6a884969c3641ffc3a4
4
+ data.tar.gz: ea850e1b573bbd9f1a92123b728e7b5a00b1682e
5
5
  SHA512:
6
- metadata.gz: f4a0c73c560386a2d8c54b22487f21855946824e58673c171ef8653e03fe4ced85de3b7fc758d6c7e298cc7c8412dcf1f76810ca0448b43aba7aaeceed26ef3c
7
- data.tar.gz: 7f66da89814c25bbec40ae3be723071bdd1b56899f9cccecb1672680f92eaab0816398ddf6123fa90d730dbdc146b77c575cba185e3be9cb4b856e9ce458d9af
6
+ metadata.gz: a0644fa501b3480a09cab9ff7868286ba7199b20187e1c04cc0c9ca1fbd06e2632f842f32d42a275b1c1c43b111d0ba99832b3a44efd2d4ab9dce0351a532fd0
7
+ data.tar.gz: bebf010a39b98ff1461cd26c357e189e74959efe07a31ad2a8fc310772f33af011979bd97e75aa96d905c7de0a94a4de480c6d777b4969e8ccc05d0076b88bb5
@@ -11,13 +11,13 @@ module MultipleMan
11
11
  end
12
12
  end
13
13
 
14
+ def self.open_channel
15
+ Thread.current[:multiple_man_channel] ||= connection.create_channel
16
+ end
17
+
14
18
  def self.connect
15
- channel = connection.create_channel
16
- begin
17
- yield new(channel) if block_given?
18
- ensure
19
- channel.close
20
- end
19
+ channel = open_channel
20
+ yield new(channel) if block_given?
21
21
  end
22
22
 
23
23
  def initialize(channel)
@@ -1,3 +1,3 @@
1
1
  module MultipleMan
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
@@ -6,11 +6,10 @@ describe MultipleMan::Connection do
6
6
  let(:mock_channel) { double(Bunny::Channel) }
7
7
 
8
8
  describe "connect" do
9
- it "should open and close the connection" do
9
+ it "should open a connection and a channel" do
10
10
  mock_bunny.should_receive(:start)
11
11
  Bunny.should_receive(:new).and_return(mock_bunny)
12
12
  mock_bunny.should_receive(:create_channel).and_return(mock_channel)
13
- mock_channel.should_receive(:close)
14
13
 
15
14
  described_class.connect
16
15
  end
@@ -9,7 +9,7 @@ describe MultipleMan::ModelPublisher do
9
9
  config.topic_name = "app"
10
10
  end
11
11
 
12
- MultipleMan::Connection.stub(:connection).and_return(double(Bunny, create_channel: channel_stub))
12
+ MultipleMan::Connection.stub(:open_channel).and_return(channel_stub)
13
13
  }
14
14
 
15
15
  class MockObject
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multiple_man
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Brunner