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 +4 -4
- data/lib/multiple_man/connection.rb +6 -6
- data/lib/multiple_man/version.rb +1 -1
- data/spec/connection_spec.rb +1 -2
- data/spec/model_publisher_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27a4153d5c70fd0caf82e6a884969c3641ffc3a4
|
4
|
+
data.tar.gz: ea850e1b573bbd9f1a92123b728e7b5a00b1682e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =
|
16
|
-
|
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)
|
data/lib/multiple_man/version.rb
CHANGED
data/spec/connection_spec.rb
CHANGED
@@ -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
|
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(:
|
12
|
+
MultipleMan::Connection.stub(:open_channel).and_return(channel_stub)
|
13
13
|
}
|
14
14
|
|
15
15
|
class MockObject
|