propono 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1ff92b911ef9f4ae48012a57710e6dc36f4afa7
4
- data.tar.gz: da17719ba6d0d5b9914892e36156af76888df5e0
3
+ metadata.gz: ebd5041633b366a91b045b834a08db2bcb2df8e4
4
+ data.tar.gz: c09df86c5c5de0b9d4322bf91ed28c894217231e
5
5
  SHA512:
6
- metadata.gz: 4188aeee17c98854395491b0453b5f51161209473f9ccc9a2692e499f529ba19d5eaa777ecb874ad1b8b5b61057110b0e8cfc940c0cd9c8ec9f9da67a42f7eeb
7
- data.tar.gz: 01ab6936c889bf091dac35b44a3bee9351a597f4ddc1fd5cb378b752027c926e86461dc66bf0a434022e4e86f9a0b4f7938635d0d56027e32ca09ccd5f522db0
6
+ metadata.gz: 441f02bdbe0d8cca77f73405330bccf7fdb3e3c1f304fb45c274bc84e95c892030042127a304720b86ec703b6c4ca2319e529567b339096a648b25880f8a33c2
7
+ data.tar.gz: 438ac5c85ccfba9774141eba4e9ad42b405e47d0adec8bb033f0415aa19551f36e6326c46df58deb871170a4ce6feb1866cefdd8bb409ea6ecd8a7fce7a5dd95
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 1.5.0 / 2015-03-16
2
+ * [BUGFIX] Fix inability to use queue if the message visibility timeout has changed.
3
+
1
4
  # 1.4.0 / 2014-07-12
2
5
  * [FEATURE] Move symbolize_keys to Propono namespace to avoid ActiveSupport conflict (:blue_heart: @tardate)
3
6
  * [BUGFIX] Drain integration tests drain queues before starting (:blue_heart: @tardate)
@@ -14,9 +14,15 @@ module Propono
14
14
  end
15
15
 
16
16
  def find_or_create
17
- result = sqs.create_queue(@name)
18
- body = result.body
19
- url = body.fetch('QueueUrl') { raise QueueCreatorError.new("No QueueUrl returned from SQS") }
17
+ urls = sqs.list_queues("QueueNamePrefix" => @name).body["QueueUrls"]
18
+ url = urls.select{|x|x =~ /#{@name}$/}.first
19
+
20
+ unless url
21
+ result = sqs.create_queue(@name)
22
+ body = result.body
23
+ url = body.fetch('QueueUrl') { raise QueueCreatorError.new("No QueueUrl returned from SQS") }
24
+ end
25
+
20
26
  Queue.new(url)
21
27
  end
22
28
  end
@@ -1,3 +1,3 @@
1
1
  module Propono
2
- VERSION = "1.4.0"
2
+ VERSION = "1.5.0"
3
3
  end
@@ -31,7 +31,7 @@ module Propono
31
31
 
32
32
  queue_name = subscription.send(:queue_name)
33
33
 
34
- sqs = mock()
34
+ sqs = Fog::AWS::SQS::Mock.new
35
35
  sqs.expects(:create_queue).with(queue_name).returns(mock(body: {'QueueUrl' => Fog::AWS::SQS::Mock::QueueUrl}))
36
36
  sqs.expects(:create_queue).with(queue_name + '-failed').returns(mock(body: {'QueueUrl' => Fog::AWS::SQS::Mock::QueueUrl}))
37
37
  sqs.expects(:create_queue).with(queue_name + '-corrupt').returns(mock(body: {'QueueUrl' => Fog::AWS::SQS::Mock::QueueUrl}))
@@ -3,8 +3,26 @@ require File.expand_path('../../test_helper', __FILE__)
3
3
  module Propono
4
4
  class QueueCreatorTest < Minitest::Test
5
5
 
6
- def test_create_topic_called_on_sqs
7
- sqs = mock()
6
+ def test_finds_existing_url
7
+ name = "foobar"
8
+ url = "http://#{name}"
9
+ sqs = Fog::AWS::SQS::Mock.new
10
+ sqs.stubs(:list_queues)
11
+ sqs.expects(:list_queues).
12
+ with("QueueNamePrefix" => "#{name}").
13
+ returns(
14
+ mock(body: { "QueueUrls" => [url]})
15
+ )
16
+
17
+ creator = QueueCreator.new(name)
18
+ creator.stubs(sqs: sqs)
19
+
20
+ queue = creator.find_or_create
21
+ assert_equal url, queue.url
22
+ end
23
+
24
+ def test_create_queue_called_on_sqs
25
+ sqs = Fog::AWS::SQS::Mock.new
8
26
  sqs.expects(:create_queue).with("foobar").returns(mock(body: { "QueueUrl" => "Foobar"}))
9
27
 
10
28
  creator = QueueCreator.new("foobar")
@@ -16,7 +34,8 @@ module Propono
16
34
  def test_returns_url
17
35
  url = "malcs_happy_queue"
18
36
  result = mock(body: { "QueueUrl" => url})
19
- sqs = mock(create_queue: result)
37
+ sqs = Fog::AWS::SQS::Mock.new
38
+ sqs.expects(create_queue: result)
20
39
 
21
40
  creator = QueueCreator.new("foobar")
22
41
  creator.stubs(sqs: sqs)
@@ -27,7 +46,8 @@ module Propono
27
46
 
28
47
  def test_should_raise_exception_if_no_queue_returned
29
48
  result = mock(body: {})
30
- sqs = mock(create_queue: result)
49
+ sqs = Fog::AWS::SQS::Mock.new
50
+ sqs.expects(create_queue: result)
31
51
 
32
52
  creator = QueueCreator.new("foobar")
33
53
  creator.stubs(sqs: sqs)
data/test/test_helper.rb CHANGED
@@ -46,6 +46,15 @@ class Fog::AWS::SNS::Mock
46
46
  end
47
47
 
48
48
  class Fog::AWS::SQS::Mock
49
+ def list_queues(*args)
50
+ foo = Object.new
51
+ class << foo
52
+ def body
53
+ {"QueueUrls" => []}
54
+ end
55
+ end
56
+ foo
57
+ end
49
58
  def create_queue(*args)
50
59
  end
51
60
  def set_queue_attributes(*args)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: propono
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MalcyL
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-26 00:00:00.000000000 Z
12
+ date: 2015-03-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog