em-pg-client 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +1 -0
- data/{BENCHMARKS.rdoc → BENCHMARKS.md} +15 -10
- data/{HISTORY.rdoc → HISTORY.md} +32 -5
- data/LICENSE +21 -0
- data/README.md +392 -0
- data/Rakefile +30 -14
- data/em-pg-client.gemspec +8 -7
- data/lib/em-pg-client.rb +1 -0
- data/lib/em-synchrony/pg.rb +2 -107
- data/lib/pg/em-version.rb +5 -0
- data/lib/pg/em.rb +638 -344
- data/lib/pg/em/client/connect_watcher.rb +65 -0
- data/lib/pg/em/client/watcher.rb +102 -0
- data/lib/pg/em/connection_pool.rb +448 -0
- data/lib/pg/em/featured_deferrable.rb +43 -0
- data/spec/connection_pool_helpers.rb +89 -0
- data/spec/{em_devel_client.rb → em_client.rb} +3 -2
- data/spec/em_client_autoreconnect.rb +268 -144
- data/spec/em_client_common.rb +55 -54
- data/spec/em_synchrony_client.rb +254 -5
- data/spec/em_synchrony_client_autoreconnect.rb +154 -130
- data/spec/pg_em_client_connect_finish.rb +54 -0
- data/spec/pg_em_client_connect_timeout.rb +91 -0
- data/spec/pg_em_client_options.rb +85 -0
- data/spec/pg_em_connection_pool.rb +655 -0
- data/spec/pg_em_featured_deferrable.rb +125 -0
- metadata +64 -34
- data/README.rdoc +0 -431
- data/spec/em_release_client.rb +0 -39
data/spec/em_release_client.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
$:.unshift "lib"
|
2
|
-
gem 'eventmachine', '= 0.12.10'
|
3
|
-
gem 'pg', ENV['EM_PG_CLIENT_TEST_PG_VERSION']
|
4
|
-
require 'date'
|
5
|
-
require 'eventmachine'
|
6
|
-
require 'pg/em'
|
7
|
-
require 'em_client_common'
|
8
|
-
RSpec.configure do |config|
|
9
|
-
config.include(PGSpecMacros)
|
10
|
-
end
|
11
|
-
|
12
|
-
describe PG::EM::Client do
|
13
|
-
|
14
|
-
include_context 'em-pg common before'
|
15
|
-
|
16
|
-
it "should populate foo with some data " do
|
17
|
-
values = @values.dup
|
18
|
-
results = []
|
19
|
-
do_query = proc do
|
20
|
-
data, id = values.shift
|
21
|
-
@client.query('INSERT INTO foo (id,cdate,data) VALUES($1,$2,$3) returning cdate', [id, DateTime.now, data]) do |result|
|
22
|
-
result.should be_an_instance_of PG::Result
|
23
|
-
results << DateTime.parse(result[0]['cdate'])
|
24
|
-
if values.empty?
|
25
|
-
@cdates.replace results
|
26
|
-
results.length.should == @values.length
|
27
|
-
results.each {|r| r.should be_an_instance_of DateTime }
|
28
|
-
EM.stop
|
29
|
-
else
|
30
|
-
do_query.call
|
31
|
-
end
|
32
|
-
end.should be_a_kind_of ::EM::DefaultDeferrable
|
33
|
-
end
|
34
|
-
do_query.call
|
35
|
-
end
|
36
|
-
|
37
|
-
include_context 'em-pg common after'
|
38
|
-
|
39
|
-
end
|