fake_sqs 0.3.0 → 0.3.1

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: d746854e3e267689813fa8d8e24ddfa7db1e9eaa
4
- data.tar.gz: fc4f7f593ddfa851824599e88101188a57a3b28c
3
+ metadata.gz: cb815a43a9c8361770d93419e8516519de9b0e65
4
+ data.tar.gz: df4679c9d5b121a6b0a18d811d3839104ab4415b
5
5
  SHA512:
6
- metadata.gz: 38dc367f4a821fcbdc3e88ea4d97ad5c20e53a54b31dbdec4e1f56a5e922a1692da7b4e96201d6578454649f2292b913957edfe55e251169ab2ff9fe706136e2
7
- data.tar.gz: e12ac670b1a5a9d529e1826e674f8d7ec625f50d81626fab4493052977a739cb8459c21415e2f594a9f82cb7a5c0a95e9c09f9df1d499071868661c0c22138ee
6
+ metadata.gz: 7326b4cc8acfcd59a6e08a84050bf14b3a30da1ce6e263ae44a0ec0cfcfd96acff1845675990dc74e9172617af1ff8506dc8b0a02f249ed65a492b31e8d6cf25
7
+ data.tar.gz: 1898c50cfbb473f5b29100efdb99f8aa0deff88a4e9a8cbe37112af08266c51ca5de178fd907eb517c2240c76d7b6ae65b41d14b22d60c1414a106a2ea4f183c
data/README.md CHANGED
@@ -77,6 +77,17 @@ AWS.config(
77
77
  )
78
78
  ```
79
79
 
80
+ ```javascript
81
+ var aws = require('aws-sdk');
82
+ var sqs = new aws.SQS({
83
+ endpoint: 'http://localhost:4568',
84
+ apiVersion: '2012-11-05',
85
+ accessKeyId: 'access key id',
86
+ secretAccessKey: 'secret access key',
87
+ region: 'region'
88
+ });
89
+ ```
90
+
80
91
  If you have the configuration options for other libraries, please give them to
81
92
  me.
82
93
 
@@ -1,4 +1,5 @@
1
1
  require "forwardable"
2
+ require "thread"
2
3
 
3
4
  module FakeSQS
4
5
  class MemoryDatabase
@@ -8,7 +9,7 @@ module FakeSQS
8
9
  :[], :[]=, :delete, :each, :select, :values
9
10
 
10
11
  def initialize
11
- @in_transaction = false
12
+ @semaphore = Mutex.new
12
13
  end
13
14
 
14
15
  def load
@@ -16,15 +17,8 @@ module FakeSQS
16
17
  end
17
18
 
18
19
  def transaction
19
- if @in_transaction
20
- raise "Already in transaction"
21
- else
22
- @in_transaction = true
23
- begin
24
- yield
25
- ensure
26
- @in_transaction = false
27
- end
20
+ @semaphore.synchronize do
21
+ yield
28
22
  end
29
23
  end
30
24
 
@@ -14,12 +14,9 @@ module FakeSQS
14
14
  end
15
15
 
16
16
  def create(name, options = {})
17
- if database[name]
18
- fail QueueNameExists, name
19
- else
20
- queue = queue_factory.new(options)
21
- database[name] = queue
22
- end
17
+ return database[name] if database[name]
18
+ queue = queue_factory.new(options)
19
+ database[name] = queue
23
20
  end
24
21
 
25
22
  def delete(name, options = {})
@@ -1,3 +1,3 @@
1
1
  module FakeSQS
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -27,11 +27,9 @@ RSpec.describe FakeSQS::Queues do
27
27
  expect(create_queue("test")).to eq queue
28
28
  end
29
29
 
30
- it "cannot create a queue with the same name" do
31
- create_queue("test")
32
- expect {
33
- create_queue("test")
34
- }.to raise_error(FakeSQS::QueueNameExists, "test")
30
+ it "returns existing queue if the queue exists" do
31
+ queue = create_queue("test")
32
+ expect(create_queue("test")).to eq(queue)
35
33
  end
36
34
 
37
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fake_sqs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - iain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-11 00:00:00.000000000 Z
11
+ date: 2015-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -219,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
219
  version: '0'
220
220
  requirements: []
221
221
  rubyforge_project:
222
- rubygems_version: 2.4.8
222
+ rubygems_version: 2.4.5.1
223
223
  signing_key:
224
224
  specification_version: 4
225
225
  summary: Provides a fake SQS server that you can run locally to test against