async_rack_test 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.rdoc +5 -0
- data/Dockerfile +21 -0
- data/Gemfile.lock +22 -19
- data/README.rdoc +5 -0
- data/docker-compose.yml +8 -0
- data/lib/async_rack_test/version.rb +1 -1
- data/spec/async_rack_test_spec.rb +19 -19
- metadata +14 -16
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ef401a532ad81b2f244d2bd603c3db7ba73bc834
|
4
|
+
data.tar.gz: 0a076fe617742f002c95625bd4fec2e4af750e4b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 763e55f83c268e12c3937da3438316ef3235117ddbd373578f56dfe736905483b4c83a6efa7c45eab14aaa09bbd3ecd6d596d4028e3ef7178f2f7f4deca8d602
|
7
|
+
data.tar.gz: 55ac81e3d205f1ad73e37b646030e17b26f4f5faded751234b2820881a24c598e56a195ea9652aebe3ef628543543755d3b2cb30d6ad190ccbc234a78c64cb2a
|
data/CHANGELOG.rdoc
CHANGED
data/Dockerfile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
FROM ruby:2.4.1
|
2
|
+
|
3
|
+
RUN apt-get -q update \
|
4
|
+
&& DEBIAN_FRONTEND=noninteractive apt-get -q -y install \
|
5
|
+
openssl \
|
6
|
+
libssl-dev \
|
7
|
+
git \
|
8
|
+
g++ \
|
9
|
+
libxml2-dev \
|
10
|
+
libxslt-dev \
|
11
|
+
libgmp-dev \
|
12
|
+
make \
|
13
|
+
&& apt-get -q -y clean \
|
14
|
+
&& rm -rf /var/lib/apt/lists
|
15
|
+
|
16
|
+
COPY . /app
|
17
|
+
WORKDIR /app
|
18
|
+
|
19
|
+
RUN bundle install
|
20
|
+
|
21
|
+
CMD ["bundle", "exec", "rspec", "spec"]
|
data/Gemfile.lock
CHANGED
@@ -1,26 +1,26 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
em-spec (0.2.6)
|
7
|
-
bacon
|
4
|
+
diff-lcs (1.3)
|
5
|
+
em-spec (0.2.7)
|
8
6
|
eventmachine
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
rspec-
|
17
|
-
|
18
|
-
rspec-
|
19
|
-
rspec-
|
20
|
-
|
21
|
-
|
22
|
-
rspec-mocks (
|
23
|
-
|
7
|
+
eventmachine (1.2.5)
|
8
|
+
rack (2.0.3)
|
9
|
+
rack-test (0.8.2)
|
10
|
+
rack (>= 1.0, < 3)
|
11
|
+
rspec (3.7.0)
|
12
|
+
rspec-core (~> 3.7.0)
|
13
|
+
rspec-expectations (~> 3.7.0)
|
14
|
+
rspec-mocks (~> 3.7.0)
|
15
|
+
rspec-core (3.7.1)
|
16
|
+
rspec-support (~> 3.7.0)
|
17
|
+
rspec-expectations (3.7.0)
|
18
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
+
rspec-support (~> 3.7.0)
|
20
|
+
rspec-mocks (3.7.0)
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
+
rspec-support (~> 3.7.0)
|
23
|
+
rspec-support (3.7.0)
|
24
24
|
|
25
25
|
PLATFORMS
|
26
26
|
ruby
|
@@ -29,3 +29,6 @@ DEPENDENCIES
|
|
29
29
|
em-spec
|
30
30
|
rack-test
|
31
31
|
rspec
|
32
|
+
|
33
|
+
BUNDLED WITH
|
34
|
+
1.15.4
|
data/README.rdoc
CHANGED
@@ -47,6 +47,11 @@ excludes the slow tests by default. To run the slow tests, use something like:
|
|
47
47
|
be rspec spec --tag slow
|
48
48
|
|
49
49
|
|
50
|
+
# With docker
|
51
|
+
docker-compose build
|
52
|
+
docker-compose run test
|
53
|
+
docker-compose run test bundle exec rspec spec --tag slow
|
54
|
+
|
50
55
|
== TODO:
|
51
56
|
|
52
57
|
MAYBE: look into rack-test giving us a simple hook to add middleware
|
data/docker-compose.yml
ADDED
@@ -17,32 +17,32 @@ describe AsyncRackTest do
|
|
17
17
|
let(:test_obj) { DummyTest.new }
|
18
18
|
describe '#sync_app' do
|
19
19
|
it 'should be a ResyncApp' do
|
20
|
-
test_obj.sync_app.
|
20
|
+
expect(test_obj.sync_app).to be_kind_of(AsyncRackTest::ResyncApp)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
describe '#async_app' do
|
25
25
|
it 'should be the original app' do
|
26
|
-
test_obj.async_app.
|
26
|
+
expect(test_obj.async_app).to be_kind_of(Proc)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
describe '#app' do
|
31
31
|
context 'default' do
|
32
32
|
it 'should be the original app' do
|
33
|
-
test_obj.app.
|
33
|
+
expect(test_obj.app).to eql(test_obj.async_app)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
context 'after calling #use_sync' do
|
37
37
|
it 'should be a ResyncApp' do
|
38
38
|
test_obj.use_sync
|
39
|
-
test_obj.app.
|
39
|
+
expect(test_obj.app).to eql(test_obj.sync_app)
|
40
40
|
end
|
41
41
|
context 'then after calling #use_async' do
|
42
42
|
it 'should be the original app' do
|
43
43
|
test_obj.use_sync
|
44
44
|
test_obj.use_async
|
45
|
-
test_obj.app.
|
45
|
+
expect(test_obj.app).to eql(test_obj.async_app)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -50,22 +50,22 @@ describe AsyncRackTest do
|
|
50
50
|
|
51
51
|
describe '#aget' do
|
52
52
|
it 'should set the app be a ResyncApp' do
|
53
|
-
test_obj.
|
54
|
-
test_obj.
|
55
|
-
test_obj.
|
53
|
+
expect(test_obj).to receive(:use_sync)
|
54
|
+
allow(test_obj).to receive(:get)
|
55
|
+
allow(test_obj).to receive(:use_async)
|
56
56
|
test_obj.aget '/'
|
57
57
|
end
|
58
58
|
it 'should call #call on #sync_app' do
|
59
|
-
test_obj.sync_app.
|
59
|
+
expect(test_obj.sync_app).to receive(:call).and_return([200, {}, []])
|
60
60
|
test_obj.aget '/'
|
61
61
|
end
|
62
62
|
it 'should call #get' do
|
63
|
-
test_obj.
|
63
|
+
expect(test_obj).to receive(:get)
|
64
64
|
test_obj.aget '/'
|
65
65
|
end
|
66
66
|
it 'should put the app back to the original' do
|
67
67
|
test_obj.aget '/'
|
68
|
-
test_obj.app.
|
68
|
+
expect(test_obj.app).to eql(test_obj.async_app)
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
@@ -75,7 +75,7 @@ describe AsyncRackTest do
|
|
75
75
|
let(:resync_app) { AsyncRackTest::ResyncApp.new(DummyTest.new.app) }
|
76
76
|
describe '#call' do
|
77
77
|
it "should call #call on the passed in app" do
|
78
|
-
resync_app.app.
|
78
|
+
expect(resync_app.app).to receive(:call).and_return([200, {}, []])
|
79
79
|
resync_app.call({})
|
80
80
|
end
|
81
81
|
|
@@ -95,10 +95,10 @@ describe AsyncRackTest do
|
|
95
95
|
thread = Thread.new { @result = resync_app.call({}) }
|
96
96
|
|
97
97
|
sleep 1 # Give some time to guarantee the thread has had time to run.
|
98
|
-
@result.
|
98
|
+
expect(@result).to be_nil
|
99
99
|
@trigger_async = true
|
100
100
|
thread.join
|
101
|
-
@result.
|
101
|
+
expect(@result).to eql([200, {}, []])
|
102
102
|
end
|
103
103
|
|
104
104
|
it "should return when the passed in app throws :async", :slow => true do
|
@@ -117,10 +117,10 @@ describe AsyncRackTest do
|
|
117
117
|
thread = Thread.new { @result = resync_app.call({}) }
|
118
118
|
|
119
119
|
sleep 1 # Give some time to guarantee the thread has had time to run.
|
120
|
-
@result.
|
120
|
+
expect(@result).to be_nil
|
121
121
|
@trigger_async = true
|
122
122
|
thread.join
|
123
|
-
@result.
|
123
|
+
expect(@result).to eql([200, {}, []])
|
124
124
|
end
|
125
125
|
|
126
126
|
it "should return instantly when the passed in app is not async", :slow => true do
|
@@ -139,7 +139,7 @@ describe AsyncRackTest do
|
|
139
139
|
thread = Thread.new { @result = resync_app.call({}) }
|
140
140
|
|
141
141
|
sleep 1 # Give some time to guarantee the thread has had time to run.
|
142
|
-
@result.
|
142
|
+
expect(@result).to eql([200, {}, []])
|
143
143
|
@trigger_async = true
|
144
144
|
sleep 1 # Give some time to guarantee the thread has had time to run.
|
145
145
|
thread.join
|
@@ -157,9 +157,9 @@ describe AsyncRackTest do
|
|
157
157
|
let(:resync_app) { AsyncRackTest::ResyncApp.new(slow_app, :timeout => 1) }
|
158
158
|
|
159
159
|
it "should time out" do
|
160
|
-
|
160
|
+
expect {
|
161
161
|
resync_app.call({})
|
162
|
-
}.
|
162
|
+
}.to raise_error(AsyncRackTest::Timeout)
|
163
163
|
end
|
164
164
|
end
|
165
165
|
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async_rack_test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Paul Cortens
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2018-01-12 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: Extends rack-test to make working with EventMachine easier.
|
15
14
|
email: paul@thoughtless.ca
|
@@ -19,13 +18,15 @@ extra_rdoc_files:
|
|
19
18
|
- README.rdoc
|
20
19
|
- CHANGELOG.rdoc
|
21
20
|
files:
|
22
|
-
- .gitignore
|
23
|
-
- .rspec
|
21
|
+
- ".gitignore"
|
22
|
+
- ".rspec"
|
24
23
|
- CHANGELOG.rdoc
|
24
|
+
- Dockerfile
|
25
25
|
- Gemfile
|
26
26
|
- Gemfile.lock
|
27
27
|
- README.rdoc
|
28
28
|
- async_rack_test.gemspec
|
29
|
+
- docker-compose.yml
|
29
30
|
- lib/async_rack_test.rb
|
30
31
|
- lib/async_rack_test/resync_app.rb
|
31
32
|
- lib/async_rack_test/version.rb
|
@@ -34,29 +35,26 @@ files:
|
|
34
35
|
homepage: http://github.com/thoughtless/async_rack_test
|
35
36
|
licenses:
|
36
37
|
- MIT
|
38
|
+
metadata: {}
|
37
39
|
post_install_message:
|
38
40
|
rdoc_options:
|
39
|
-
- --charset=UTF-8
|
41
|
+
- "--charset=UTF-8"
|
40
42
|
require_paths:
|
41
43
|
- lib
|
42
44
|
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
45
|
requirements:
|
45
|
-
- -
|
46
|
+
- - ">="
|
46
47
|
- !ruby/object:Gem::Version
|
47
48
|
version: '0'
|
48
49
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0'
|
54
54
|
requirements: []
|
55
55
|
rubyforge_project:
|
56
|
-
rubygems_version:
|
56
|
+
rubygems_version: 2.6.13
|
57
57
|
signing_key:
|
58
|
-
specification_version:
|
59
|
-
summary: async_rack_test-0.0.
|
60
|
-
test_files:
|
61
|
-
- spec/async_rack_test_spec.rb
|
62
|
-
- spec/spec_helper.rb
|
58
|
+
specification_version: 4
|
59
|
+
summary: async_rack_test-0.0.6
|
60
|
+
test_files: []
|