fairway 0.0.1 → 0.0.2

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.
@@ -10,8 +10,8 @@ module Fairway
10
10
  @connection.deliver(message, channel)
11
11
  end
12
12
 
13
- def scripts
14
- @connection.scripts
13
+ def method_missing(method, *args)
14
+ @connection.respond_to?(method) ? @connection.send(method, *args) : super
15
15
  end
16
16
  end
17
17
  end
@@ -20,9 +20,20 @@ module Fairway
20
20
  )
21
21
  end
22
22
 
23
+ def subscribe(channel_pattern, &block)
24
+ redis.psubscribe(channel_pattern) do |on|
25
+ on.pmessage do |pattern, channel, message|
26
+ block.call(channel, message)
27
+ end
28
+ end
29
+ end
30
+
23
31
  def scripts
24
32
  @config.scripts
25
33
  end
26
34
 
35
+ def redis
36
+ @config.redis
37
+ end
27
38
  end
28
39
  end
@@ -1,3 +1,3 @@
1
1
  module Fairway
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -7,14 +7,20 @@ module Fairway
7
7
  c.facet { |message| message[:facet] }
8
8
  end
9
9
  end
10
+ let(:base_connection) { Connection.new(config) }
10
11
  let(:connection) do
11
- ChanneledConnection.new(Connection.new(config)) do |message|
12
+ ChanneledConnection.new(base_connection) do |message|
12
13
  message[:topic]
13
14
  end
14
15
  end
15
16
  let(:redis) { config.redis }
16
17
  let(:message) { { facet: 1, topic: "event:helloworld" } }
17
18
 
19
+ it "delegates non existant methods to parent connection" do
20
+ base_connection.should_receive(:random_method)
21
+ connection.random_method
22
+ end
23
+
18
24
  describe "#deliver" do
19
25
  context "multiple queues exist for message type" do
20
26
  it "adds message for both queues" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fairway
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: