nezu 0.7.0 → 0.7.1

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.0
1
+ 0.7.1
@@ -3,16 +3,13 @@ module Nezu
3
3
  class Producer
4
4
  extend Nezu::Runtime::Common
5
5
 
6
- def self.inherited(subclass)
7
- super
8
- @@connection = Bunny.new(configatron.amqp.send(Nezu.env.to_sym).url)
9
- @@connection.start
10
- @@channel = @@connection.create_channel
11
- end
12
-
13
6
  def self.push!(params = {})
14
- @@queue ||= @@channel.queue(queue_name)
15
- @@queue.publish(params.to_json, :content_type => 'application/json')
7
+ connection = Bunny.new(configatron.amqp.send(Nezu.env.to_sym).url, :threaded => false)
8
+ connection.start
9
+ channel = connection.create_channel
10
+ queue ||= channel.queue(queue_name)
11
+ queue.publish(params.to_json, :content_type => 'application/json')
12
+ connection.close
16
13
  end
17
14
  end
18
15
  end
@@ -8,7 +8,14 @@ describe Nezu::Runtime::Producer do
8
8
  describe '::push!' do
9
9
  it 'should create a new message on the server' do
10
10
  configatron.amqp.send(Nezu.env.to_sym).url = 'amqp://127.0.0.1'
11
- Bunny.should_receive(:new).with(configatron.amqp.send(Nezu.env.to_sym).url).and_return(AlwaysHappy.new)
11
+ Bunny.should_receive(:new).with(configatron.amqp.send(Nezu.env.to_sym).url, :threaded=>false).and_return(AlwaysHappy.new)
12
+ module ExampleProducers;class MyQueue<Nezu::Runtime::Producer;end;end
13
+ ExampleProducers::MyQueue.push!(:foo => 'bar')
14
+ end
15
+
16
+ it 'should close its connection' do
17
+ configatron.amqp.send(Nezu.env.to_sym).url = 'amqp://127.0.0.1'
18
+ Bunny::Session.any_instance.should_receive(:close)
12
19
  module ExampleProducers;class MyQueue<Nezu::Runtime::Producer;end;end
13
20
  ExampleProducers::MyQueue.push!(:foo => 'bar')
14
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nezu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-07-02 00:00:00.000000000 Z
13
+ date: 2013-07-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: amqp