asyncapi-server 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +38 -1
- data/lib/asyncapi/server.rb +3 -0
- data/lib/asyncapi/server/rails_ext/controller.rb +3 -1
- data/lib/asyncapi/server/version.rb +1 -1
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +2 -2
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +43 -0
- data/spec/dummy/log/test.log +3545 -0
- data/spec/requests/enqueueing_jobs_spec.rb +5 -16
- data/spec/spec_helper.rb +5 -3
- metadata +59 -17
- data/spec/dummy/db/migrate/20141212065005_create_asyncapi_server_jobs.asyncapi_server.rb +0 -11
- data/spec/dummy/db/migrate/20141212065006_add_secret_to_asyncapi_server_job.asyncapi_server.rb +0 -6
- data/spec/dummy/db/migrate/20150130062901_add_expired_at_to_asyncapi_server_job.asyncapi_server.rb +0 -12
- data/spec/dummy/db/migrate/20150201231329_drop_expired_at_from_asyncapi_server_jobs.asyncapi_server.rb +0 -10
@@ -4,21 +4,8 @@ describe "Enqueueing jobs", type: :request do
|
|
4
4
|
|
5
5
|
let(:job) { build_stubbed(:asyncapi_server_job, secret: "secret") }
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
class_name: "Runner",
|
10
|
-
callback_url: "callback_url",
|
11
|
-
params: {client: "params"}.to_json,
|
12
|
-
secret: "secret",
|
13
|
-
).and_return(job)
|
14
|
-
|
15
|
-
allow(job).to receive(:url).and_return("server_job_url")
|
16
|
-
end
|
17
|
-
|
18
|
-
it "allows asynchronous handing of http requests and cleans up old jobs" do
|
19
|
-
expect(Asyncapi::Server::JobWorker).to receive(:perform_async).with(job.id)
|
20
|
-
|
21
|
-
post("tests", job: {
|
7
|
+
it "allows asynchronous handling of http requests and cleans up old jobs", cleaning_strategy: :truncation do
|
8
|
+
post("/tests", job: {
|
22
9
|
callback_url: "callback_url",
|
23
10
|
params: {client: "params"}.to_json,
|
24
11
|
secret: "secret",
|
@@ -26,7 +13,9 @@ describe "Enqueueing jobs", type: :request do
|
|
26
13
|
|
27
14
|
expect(response).to be_successful
|
28
15
|
parsed_response = indifferent_hash(response.body)[:job]
|
29
|
-
expect(
|
16
|
+
expect(Asyncapi::Server::JobWorker).
|
17
|
+
to have_enqueued_job(parsed_response[:id])
|
18
|
+
expect(parsed_response[:url]).to be_present
|
30
19
|
expect(parsed_response[:secret]).to eq "secret"
|
31
20
|
end
|
32
21
|
|
data/spec/spec_helper.rb
CHANGED
@@ -9,6 +9,7 @@ require "factory_girl_rails"
|
|
9
9
|
require "pry"
|
10
10
|
require "database_cleaner"
|
11
11
|
require "timecop"
|
12
|
+
require 'rspec-sidekiq'
|
12
13
|
|
13
14
|
Rails.backtrace_cleaner.remove_silencers!
|
14
15
|
|
@@ -29,12 +30,13 @@ RSpec.configure do |config|
|
|
29
30
|
DatabaseCleaner.clean_with :truncation
|
30
31
|
end
|
31
32
|
|
32
|
-
config.before do
|
33
|
-
DatabaseCleaner.strategy = :
|
33
|
+
config.before do |example|
|
34
|
+
DatabaseCleaner.strategy = example.metadata[:cleaning_strategy] ||
|
35
|
+
:transaction
|
34
36
|
DatabaseCleaner.start
|
35
37
|
end
|
36
38
|
|
37
|
-
config.
|
39
|
+
config.append_after(:each) do
|
38
40
|
DatabaseCleaner.clean
|
39
41
|
end
|
40
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asyncapi-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- G5
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-07-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: kaminari
|
@@ -44,18 +44,32 @@ dependencies:
|
|
44
44
|
name: rails
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - "
|
47
|
+
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '0'
|
49
|
+
version: '4.0'
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- - "
|
54
|
+
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: '0'
|
56
|
+
version: '4.0'
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: active_model_serializers
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 0.9.0
|
64
|
+
type: :runtime
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 0.9.0
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: typhoeus
|
59
73
|
requirement: !ruby/object:Gem::Requirement
|
60
74
|
requirements:
|
61
75
|
- - ">="
|
@@ -69,7 +83,7 @@ dependencies:
|
|
69
83
|
- !ruby/object:Gem::Version
|
70
84
|
version: '0'
|
71
85
|
- !ruby/object:Gem::Dependency
|
72
|
-
name:
|
86
|
+
name: sidekiq
|
73
87
|
requirement: !ruby/object:Gem::Requirement
|
74
88
|
requirements:
|
75
89
|
- - ">="
|
@@ -83,7 +97,21 @@ dependencies:
|
|
83
97
|
- !ruby/object:Gem::Version
|
84
98
|
version: '0'
|
85
99
|
- !ruby/object:Gem::Dependency
|
86
|
-
name:
|
100
|
+
name: responders
|
101
|
+
requirement: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - "~>"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '2.0'
|
106
|
+
type: :runtime
|
107
|
+
prerelease: false
|
108
|
+
version_requirements: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - "~>"
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '2.0'
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: ar_after_transaction
|
87
115
|
requirement: !ruby/object:Gem::Requirement
|
88
116
|
requirements:
|
89
117
|
- - ">="
|
@@ -138,6 +166,20 @@ dependencies:
|
|
138
166
|
- - "~>"
|
139
167
|
- !ruby/object:Gem::Version
|
140
168
|
version: 1.1.0
|
169
|
+
- !ruby/object:Gem::Dependency
|
170
|
+
name: rspec-sidekiq
|
171
|
+
requirement: !ruby/object:Gem::Requirement
|
172
|
+
requirements:
|
173
|
+
- - ">="
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
176
|
+
type: :development
|
177
|
+
prerelease: false
|
178
|
+
version_requirements: !ruby/object:Gem::Requirement
|
179
|
+
requirements:
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '0'
|
141
183
|
- !ruby/object:Gem::Dependency
|
142
184
|
name: pry
|
143
185
|
requirement: !ruby/object:Gem::Requirement
|
@@ -257,11 +299,11 @@ files:
|
|
257
299
|
- spec/dummy/config/locales/en.yml
|
258
300
|
- spec/dummy/config/routes.rb
|
259
301
|
- spec/dummy/config/secrets.yml
|
260
|
-
- spec/dummy/db/
|
261
|
-
- spec/dummy/db/migrate/20141212065006_add_secret_to_asyncapi_server_job.asyncapi_server.rb
|
262
|
-
- spec/dummy/db/migrate/20150130062901_add_expired_at_to_asyncapi_server_job.asyncapi_server.rb
|
263
|
-
- spec/dummy/db/migrate/20150201231329_drop_expired_at_from_asyncapi_server_jobs.asyncapi_server.rb
|
302
|
+
- spec/dummy/db/development.sqlite3
|
264
303
|
- spec/dummy/db/schema.rb
|
304
|
+
- spec/dummy/db/test.sqlite3
|
305
|
+
- spec/dummy/log/development.log
|
306
|
+
- spec/dummy/log/test.log
|
265
307
|
- spec/dummy/public/404.html
|
266
308
|
- spec/dummy/public/422.html
|
267
309
|
- spec/dummy/public/500.html
|
@@ -296,7 +338,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
296
338
|
version: '0'
|
297
339
|
requirements: []
|
298
340
|
rubyforge_project:
|
299
|
-
rubygems_version: 2.4
|
341
|
+
rubygems_version: 2.6.4
|
300
342
|
signing_key:
|
301
343
|
specification_version: 4
|
302
344
|
summary: Asynchronous API communication - Server
|
@@ -331,11 +373,11 @@ test_files:
|
|
331
373
|
- spec/dummy/config/routes.rb
|
332
374
|
- spec/dummy/config/secrets.yml
|
333
375
|
- spec/dummy/config.ru
|
334
|
-
- spec/dummy/db/
|
335
|
-
- spec/dummy/db/migrate/20141212065006_add_secret_to_asyncapi_server_job.asyncapi_server.rb
|
336
|
-
- spec/dummy/db/migrate/20150130062901_add_expired_at_to_asyncapi_server_job.asyncapi_server.rb
|
337
|
-
- spec/dummy/db/migrate/20150201231329_drop_expired_at_from_asyncapi_server_jobs.asyncapi_server.rb
|
376
|
+
- spec/dummy/db/development.sqlite3
|
338
377
|
- spec/dummy/db/schema.rb
|
378
|
+
- spec/dummy/db/test.sqlite3
|
379
|
+
- spec/dummy/log/development.log
|
380
|
+
- spec/dummy/log/test.log
|
339
381
|
- spec/dummy/public/404.html
|
340
382
|
- spec/dummy/public/422.html
|
341
383
|
- spec/dummy/public/500.html
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# This migration comes from asyncapi_server (originally 20141112034324)
|
2
|
-
class CreateAsyncapiServerJobs < ActiveRecord::Migration
|
3
|
-
def change
|
4
|
-
create_table :asyncapi_server_jobs do |t|
|
5
|
-
t.integer :status
|
6
|
-
t.string :callback_url
|
7
|
-
t.string :class_name
|
8
|
-
t.text :params
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
data/spec/dummy/db/migrate/20150130062901_add_expired_at_to_asyncapi_server_job.asyncapi_server.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# This migration comes from asyncapi_server (originally 20150130062520)
|
2
|
-
class AddExpiredAtToAsyncapiServerJob < ActiveRecord::Migration
|
3
|
-
def change
|
4
|
-
add_column :asyncapi_server_jobs, :expired_at, :datetime
|
5
|
-
|
6
|
-
Asyncapi::Server::Job.reset_column_information
|
7
|
-
|
8
|
-
Asyncapi::Server::Job.
|
9
|
-
where(Asyncapi::Server::Job.arel_table[:expired_at].eq(nil)).
|
10
|
-
update_all(expired_at: Asyncapi::Server.expiry_threshold.from_now)
|
11
|
-
end
|
12
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# This migration comes from asyncapi_server (originally 20150201231018)
|
2
|
-
class DropExpiredAtFromAsyncapiServerJobs < ActiveRecord::Migration
|
3
|
-
def up
|
4
|
-
remove_column :asyncapi_server_jobs, :expired_at
|
5
|
-
end
|
6
|
-
|
7
|
-
def down
|
8
|
-
add_column :asyncapi_server_jobs, :expired_at, :datetime
|
9
|
-
end
|
10
|
-
end
|