flapjack 0.6.59 → 0.6.60

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,6 +18,8 @@ module Flapjack
18
18
  class << self
19
19
 
20
20
  def start
21
+ @logger.info("starting")
22
+ @logger.debug("new email gateway pikelet with the following options: #{@config.inspect}")
21
23
  @smtp_config = @config.delete('smtp_config')
22
24
  @sent = 0
23
25
  end
@@ -147,6 +147,11 @@ module Flapjack
147
147
  pikelet_klass.instance_variable_set('@redis_config', @redis_config)
148
148
  pikelet_klass.instance_variable_set('@logger', @logger)
149
149
 
150
+ unless defined?(@@resque_pool) && !@@resque_pool.nil?
151
+ @@resque_pool = Flapjack::RedisPool.new(:config => @redis_config)
152
+ ::Resque.redis = @@resque_pool
153
+ end
154
+
150
155
  # TODO error if config['queue'].nil?
151
156
 
152
157
  @worker = EM::Resque::Worker.new(@config['queue'])
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  module Flapjack
4
- VERSION = "0.6.59"
4
+ VERSION = "0.6.60"
5
5
  end
@@ -10,6 +10,10 @@ describe Flapjack::Pikelet do
10
10
 
11
11
  let(:fiber) { mock(Fiber) }
12
12
 
13
+ before do
14
+ Flapjack::Pikelet::Resque.class_variable_set(:@@resque_pool, nil)
15
+ end
16
+
13
17
  it "creates and starts an executive pikelet" do
14
18
  Flapjack::Logger.should_receive(:new).and_return(logger)
15
19
 
@@ -56,6 +60,10 @@ describe Flapjack::Pikelet do
56
60
  config.should_receive(:[]).with('logger').and_return(nil)
57
61
  config.should_receive(:[]).with('queue').and_return('email_notif')
58
62
 
63
+ redis = mock('redis')
64
+ Flapjack::RedisPool.should_receive(:new).and_return(redis)
65
+ Resque.should_receive(:redis=).with( redis )
66
+
59
67
  Flapjack::Gateways::Email.should_receive(:instance_variable_set).
60
68
  with('@config', config)
61
69
  Flapjack::Gateways::Email.should_receive(:instance_variable_set).
@@ -77,13 +85,19 @@ describe Flapjack::Pikelet do
77
85
  pik.start
78
86
  end
79
87
 
88
+
80
89
  it "handles an exception raised by a resque worker gateway" do
90
+
81
91
  Flapjack::Logger.should_receive(:new).and_return(logger)
82
92
  logger.should_receive(:fatal)
83
93
 
84
94
  config.should_receive(:[]).with('logger').and_return(nil)
85
95
  config.should_receive(:[]).with('queue').and_return('email_notif')
86
96
 
97
+ redis = mock('redis')
98
+ Flapjack::RedisPool.should_receive(:new).and_return(redis)
99
+ Resque.should_receive(:redis=).with( redis )
100
+
87
101
  Flapjack::Gateways::Email.should_receive(:instance_variable_set).
88
102
  with('@config', config)
89
103
  Flapjack::Gateways::Email.should_receive(:instance_variable_set).
@@ -134,4 +148,4 @@ describe Flapjack::Pikelet do
134
148
  pik.start
135
149
  end
136
150
 
137
- end
151
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flapjack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.59
4
+ version: 0.6.60
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-12-27 00:00:00.000000000 Z
14
+ date: 2012-12-30 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: dante
@@ -481,7 +481,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
481
481
  version: '0'
482
482
  segments:
483
483
  - 0
484
- hash: -4498964249235778602
484
+ hash: 3922844473422717495
485
485
  required_rubygems_version: !ruby/object:Gem::Requirement
486
486
  none: false
487
487
  requirements:
@@ -490,7 +490,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
490
490
  version: '0'
491
491
  segments:
492
492
  - 0
493
- hash: -4498964249235778602
493
+ hash: 3922844473422717495
494
494
  requirements: []
495
495
  rubyforge_project:
496
496
  rubygems_version: 1.8.23