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 +4 -4
- data/README.md +11 -0
- data/lib/fake_sqs/memory_database.rb +4 -10
- data/lib/fake_sqs/queues.rb +3 -6
- data/lib/fake_sqs/version.rb +1 -1
- data/spec/unit/queues_spec.rb +3 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb815a43a9c8361770d93419e8516519de9b0e65
|
4
|
+
data.tar.gz: df4679c9d5b121a6b0a18d811d3839104ab4415b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
@
|
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
|
-
|
20
|
-
|
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
|
|
data/lib/fake_sqs/queues.rb
CHANGED
@@ -14,12 +14,9 @@ module FakeSQS
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def create(name, options = {})
|
17
|
-
if database[name]
|
18
|
-
|
19
|
-
|
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 = {})
|
data/lib/fake_sqs/version.rb
CHANGED
data/spec/unit/queues_spec.rb
CHANGED
@@ -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 "
|
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.
|
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-
|
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.
|
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
|