lsqs 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +54 -0
- data/Rakefile +1 -0
- data/bin/console +6 -0
- data/bin/lsqs-server +4 -0
- data/config/template.xml.liquid +9 -0
- data/config.ru +4 -0
- data/lib/lsqs/action_router.rb +35 -0
- data/lib/lsqs/actions/base.rb +51 -0
- data/lib/lsqs/actions/change_message_visibility.rb +23 -0
- data/lib/lsqs/actions/create_queue.rb +22 -0
- data/lib/lsqs/actions/delete_message.rb +22 -0
- data/lib/lsqs/actions/delete_message_batch.rb +36 -0
- data/lib/lsqs/actions/delete_queue.rb +18 -0
- data/lib/lsqs/actions/get_queue_url.rb +23 -0
- data/lib/lsqs/actions/list_queues.rb +22 -0
- data/lib/lsqs/actions/purge_queue.rb +19 -0
- data/lib/lsqs/actions/receive_message.rb +27 -0
- data/lib/lsqs/actions/send_message.rb +21 -0
- data/lib/lsqs/actions/send_message_batch.rb +42 -0
- data/lib/lsqs/error_handler.rb +65 -0
- data/lib/lsqs/message.rb +49 -0
- data/lib/lsqs/queue.rb +176 -0
- data/lib/lsqs/queue_list.rb +90 -0
- data/lib/lsqs/server.rb +59 -0
- data/lib/lsqs/version.rb +3 -0
- data/lib/lsqs/xml_template.rb +54 -0
- data/lib/lsqs.rb +45 -0
- data/lsqs.gemspec +31 -0
- data/spec/lsqs/action_router_spec.rb +21 -0
- data/spec/lsqs/aws_sdk_actions_spec.rb +346 -0
- data/spec/lsqs/message_spec.rb +61 -0
- data/spec/lsqs/queue_list_spec.rb +99 -0
- data/spec/lsqs/queue_spec.rb +192 -0
- data/spec/lsqs/xml_template_spec.rb +64 -0
- data/spec/spec_helper.rb +24 -0
- metadata +232 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe LSQS::XMLTemplate do
|
4
|
+
before do
|
5
|
+
@xml_template = described_class.new
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#initialize' do
|
9
|
+
it 'initializes with a liquid template' do
|
10
|
+
@xml_template.template.kind_of?(Liquid::Template).should be_truthy
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#render' do
|
15
|
+
before do
|
16
|
+
@action = OpenStruct.new(:name => 'Foo', :to_xml => '<Bar>Foo Bar</Bar>')
|
17
|
+
@result = @xml_template.render(@action)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'renders XML and returns a string' do
|
21
|
+
@result.kind_of?(String).should be_truthy
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'includes opening closing xml tags' do
|
25
|
+
@result.include?('<xml').should be_truthy
|
26
|
+
@result.include?('</xml>').should be_truthy
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'includes the result name properly' do
|
30
|
+
@result.include?("<#{@action.name}Result>").should be_truthy
|
31
|
+
@result.include?("</#{@action.name}Result>").should be_truthy
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'includes the content' do
|
35
|
+
@result.include?(@action.to_xml).should be_truthy
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe '#render_error' do
|
40
|
+
before do
|
41
|
+
@error = '<error>Foo did not work that well.</error>'
|
42
|
+
@result = @xml_template.render_error(@error)
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'renders XML and returns a string' do
|
46
|
+
@result.kind_of?(String).should be_truthy
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'includes opening closing xml tags' do
|
50
|
+
@result.include?('<xml').should be_truthy
|
51
|
+
@result.include?('</xml>').should be_truthy
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'includes the error' do
|
55
|
+
@result.include?(@error).should be_truthy
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe '#request_id' do
|
60
|
+
it 'returns a string' do
|
61
|
+
@xml_template.request_id.kind_of?(String).should be_truthy
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'lsqs'
|
2
|
+
require 'webmock/rspec'
|
3
|
+
include LSQS
|
4
|
+
|
5
|
+
if ENV['COVERAGE']
|
6
|
+
require 'simplecov'
|
7
|
+
SimpleCov.start
|
8
|
+
end
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.color = true
|
12
|
+
|
13
|
+
config.expect_with :rspec do |c|
|
14
|
+
c.syntax = [:should, :expect]
|
15
|
+
end
|
16
|
+
|
17
|
+
config.mock_with :rspec do |c|
|
18
|
+
c.syntax = [:should, :expect]
|
19
|
+
end
|
20
|
+
|
21
|
+
config.before(:each) do
|
22
|
+
stub_request(:any, /www.example.com/).to_rack(Server)
|
23
|
+
end
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,232 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lsqs
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- giannismelidis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: liquid
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sinatra
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: puma
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activesupport
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: builder
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pry
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: aws-sdk
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: webmock
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
description: Gem that allows you to run a version of SQS server locally.
|
154
|
+
email:
|
155
|
+
- gmelidis@engineer.com
|
156
|
+
executables:
|
157
|
+
- console
|
158
|
+
- lsqs-server
|
159
|
+
extensions: []
|
160
|
+
extra_rdoc_files: []
|
161
|
+
files:
|
162
|
+
- ".gitignore"
|
163
|
+
- Gemfile
|
164
|
+
- LICENSE.txt
|
165
|
+
- README.md
|
166
|
+
- Rakefile
|
167
|
+
- bin/console
|
168
|
+
- bin/lsqs-server
|
169
|
+
- config.ru
|
170
|
+
- config/template.xml.liquid
|
171
|
+
- lib/lsqs.rb
|
172
|
+
- lib/lsqs/action_router.rb
|
173
|
+
- lib/lsqs/actions/base.rb
|
174
|
+
- lib/lsqs/actions/change_message_visibility.rb
|
175
|
+
- lib/lsqs/actions/create_queue.rb
|
176
|
+
- lib/lsqs/actions/delete_message.rb
|
177
|
+
- lib/lsqs/actions/delete_message_batch.rb
|
178
|
+
- lib/lsqs/actions/delete_queue.rb
|
179
|
+
- lib/lsqs/actions/get_queue_url.rb
|
180
|
+
- lib/lsqs/actions/list_queues.rb
|
181
|
+
- lib/lsqs/actions/purge_queue.rb
|
182
|
+
- lib/lsqs/actions/receive_message.rb
|
183
|
+
- lib/lsqs/actions/send_message.rb
|
184
|
+
- lib/lsqs/actions/send_message_batch.rb
|
185
|
+
- lib/lsqs/error_handler.rb
|
186
|
+
- lib/lsqs/message.rb
|
187
|
+
- lib/lsqs/queue.rb
|
188
|
+
- lib/lsqs/queue_list.rb
|
189
|
+
- lib/lsqs/server.rb
|
190
|
+
- lib/lsqs/version.rb
|
191
|
+
- lib/lsqs/xml_template.rb
|
192
|
+
- lsqs.gemspec
|
193
|
+
- spec/lsqs/action_router_spec.rb
|
194
|
+
- spec/lsqs/aws_sdk_actions_spec.rb
|
195
|
+
- spec/lsqs/message_spec.rb
|
196
|
+
- spec/lsqs/queue_list_spec.rb
|
197
|
+
- spec/lsqs/queue_spec.rb
|
198
|
+
- spec/lsqs/xml_template_spec.rb
|
199
|
+
- spec/spec_helper.rb
|
200
|
+
homepage: http://github.com/giannismelidis/lsqs
|
201
|
+
licenses: []
|
202
|
+
metadata: {}
|
203
|
+
post_install_message:
|
204
|
+
rdoc_options: []
|
205
|
+
require_paths:
|
206
|
+
- lib
|
207
|
+
- config
|
208
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
209
|
+
requirements:
|
210
|
+
- - ">="
|
211
|
+
- !ruby/object:Gem::Version
|
212
|
+
version: '0'
|
213
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
214
|
+
requirements:
|
215
|
+
- - ">="
|
216
|
+
- !ruby/object:Gem::Version
|
217
|
+
version: '0'
|
218
|
+
requirements: []
|
219
|
+
rubyforge_project:
|
220
|
+
rubygems_version: 2.4.5.1
|
221
|
+
signing_key:
|
222
|
+
specification_version: 4
|
223
|
+
summary: Gem that allows you to run a version of SQS server locally.
|
224
|
+
test_files:
|
225
|
+
- spec/lsqs/action_router_spec.rb
|
226
|
+
- spec/lsqs/aws_sdk_actions_spec.rb
|
227
|
+
- spec/lsqs/message_spec.rb
|
228
|
+
- spec/lsqs/queue_list_spec.rb
|
229
|
+
- spec/lsqs/queue_spec.rb
|
230
|
+
- spec/lsqs/xml_template_spec.rb
|
231
|
+
- spec/spec_helper.rb
|
232
|
+
has_rdoc:
|