sequel 0.5.0.2 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +18 -18
- data/Rakefile +17 -98
- data/lib/sequel.rb +2 -71
- metadata +10 -108
- data/CHANGELOG +0 -989
- data/bin/sequel +0 -41
- data/lib/sequel/adapters/adapter_skeleton.rb +0 -68
- data/lib/sequel/adapters/ado.rb +0 -100
- data/lib/sequel/adapters/db2.rb +0 -158
- data/lib/sequel/adapters/dbi.rb +0 -126
- data/lib/sequel/adapters/informix.rb +0 -87
- data/lib/sequel/adapters/jdbc.rb +0 -108
- data/lib/sequel/adapters/mysql.rb +0 -269
- data/lib/sequel/adapters/odbc.rb +0 -145
- data/lib/sequel/adapters/odbc_mssql.rb +0 -93
- data/lib/sequel/adapters/openbase.rb +0 -90
- data/lib/sequel/adapters/oracle.rb +0 -99
- data/lib/sequel/adapters/postgres.rb +0 -519
- data/lib/sequel/adapters/sqlite.rb +0 -192
- data/lib/sequel/ado.rb +0 -6
- data/lib/sequel/array_keys.rb +0 -296
- data/lib/sequel/connection_pool.rb +0 -152
- data/lib/sequel/core_ext.rb +0 -59
- data/lib/sequel/core_sql.rb +0 -191
- data/lib/sequel/database.rb +0 -433
- data/lib/sequel/dataset.rb +0 -409
- data/lib/sequel/dataset/convenience.rb +0 -321
- data/lib/sequel/dataset/sequelizer.rb +0 -354
- data/lib/sequel/dataset/sql.rb +0 -586
- data/lib/sequel/db2.rb +0 -6
- data/lib/sequel/dbi.rb +0 -6
- data/lib/sequel/exceptions.rb +0 -45
- data/lib/sequel/informix.rb +0 -6
- data/lib/sequel/migration.rb +0 -191
- data/lib/sequel/model.rb +0 -8
- data/lib/sequel/mysql.rb +0 -6
- data/lib/sequel/odbc.rb +0 -6
- data/lib/sequel/oracle.rb +0 -6
- data/lib/sequel/postgres.rb +0 -6
- data/lib/sequel/pretty_table.rb +0 -73
- data/lib/sequel/schema.rb +0 -8
- data/lib/sequel/schema/schema_generator.rb +0 -131
- data/lib/sequel/schema/schema_sql.rb +0 -131
- data/lib/sequel/sqlite.rb +0 -6
- data/lib/sequel/worker.rb +0 -58
- data/spec/adapters/informix_spec.rb +0 -139
- data/spec/adapters/mysql_spec.rb +0 -330
- data/spec/adapters/oracle_spec.rb +0 -130
- data/spec/adapters/postgres_spec.rb +0 -189
- data/spec/adapters/sqlite_spec.rb +0 -345
- data/spec/array_keys_spec.rb +0 -679
- data/spec/connection_pool_spec.rb +0 -356
- data/spec/core_ext_spec.rb +0 -67
- data/spec/core_sql_spec.rb +0 -301
- data/spec/database_spec.rb +0 -811
- data/spec/dataset_spec.rb +0 -2381
- data/spec/migration_spec.rb +0 -261
- data/spec/pretty_table_spec.rb +0 -66
- data/spec/rcov.opts +0 -4
- data/spec/schema_generator_spec.rb +0 -86
- data/spec/schema_spec.rb +0 -230
- data/spec/sequel_spec.rb +0 -10
- data/spec/sequelizer_spec.rb +0 -389
- data/spec/spec.opts +0 -5
- data/spec/spec_helper.rb +0 -44
- data/spec/worker_spec.rb +0 -96
data/spec/worker_spec.rb
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'spec_helper')
|
2
|
-
|
3
|
-
context "A worker" do
|
4
|
-
setup do
|
5
|
-
@w = Sequel::Worker.new
|
6
|
-
end
|
7
|
-
|
8
|
-
teardown do
|
9
|
-
sleep 0.1
|
10
|
-
@w.join if @w
|
11
|
-
end
|
12
|
-
|
13
|
-
specify "should be a thread" do
|
14
|
-
@w.should be_a_kind_of(Thread)
|
15
|
-
end
|
16
|
-
|
17
|
-
specify "should be alive until it is joined" do
|
18
|
-
@w.should be_alive
|
19
|
-
end
|
20
|
-
|
21
|
-
specify "should be busy if any jobs are pending" do
|
22
|
-
@w.should_not be_busy
|
23
|
-
@w.add {sleep 0.5}
|
24
|
-
@w.should be_busy
|
25
|
-
end
|
26
|
-
|
27
|
-
specify "should accept jobs and perform them in the correct order" do
|
28
|
-
values = []
|
29
|
-
@w.add {values << 1}
|
30
|
-
@w.async {values << 2}
|
31
|
-
@w << proc {values << 3}
|
32
|
-
|
33
|
-
@w.join
|
34
|
-
values.should == [1, 2, 3]
|
35
|
-
end
|
36
|
-
|
37
|
-
specify "should isolate errors and hold them in #errors" do
|
38
|
-
values = []
|
39
|
-
@w.add {values << 1}
|
40
|
-
@w.async {values << 2}
|
41
|
-
@w.async {raise "bad bad bad"}
|
42
|
-
@w << proc {values << 3}
|
43
|
-
|
44
|
-
@w.join
|
45
|
-
values.should == [1, 2, 3]
|
46
|
-
@w.errors.size.should == 1
|
47
|
-
@w.errors.first.message.should == 'bad bad bad'
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
context "A worker with a given db" do
|
52
|
-
setup do
|
53
|
-
@db = MockDatabase.new
|
54
|
-
@m = Module.new do
|
55
|
-
def transaction
|
56
|
-
execute('BEGIN')
|
57
|
-
yield
|
58
|
-
execute('COMMIT')
|
59
|
-
rescue
|
60
|
-
execute('ROLLBACK')
|
61
|
-
end
|
62
|
-
end
|
63
|
-
@db.extend(@m)
|
64
|
-
@w = Sequel::Worker.new(@db)
|
65
|
-
end
|
66
|
-
|
67
|
-
teardown do
|
68
|
-
@w.join if @w
|
69
|
-
end
|
70
|
-
|
71
|
-
specify "should wrap everything in a transaction" do
|
72
|
-
@w.async {@db[:items] << {:x => 1}}
|
73
|
-
@w.join
|
74
|
-
@w = nil
|
75
|
-
@db.sqls.should == [
|
76
|
-
'BEGIN',
|
77
|
-
'INSERT INTO items (x) VALUES (1)',
|
78
|
-
'COMMIT'
|
79
|
-
]
|
80
|
-
end
|
81
|
-
|
82
|
-
specify "should rollback the transaction if any error is raised" do
|
83
|
-
@w.async {@db[:items] << {:x => 1}}
|
84
|
-
@w.async {sleep 0.2; raise "that's bad"}
|
85
|
-
@w.async {@db[:items] << {:x => 2}}
|
86
|
-
@w.join
|
87
|
-
@db.sqls.should == [
|
88
|
-
'BEGIN',
|
89
|
-
'INSERT INTO items (x) VALUES (1)',
|
90
|
-
'INSERT INTO items (x) VALUES (2)',
|
91
|
-
'ROLLBACK'
|
92
|
-
]
|
93
|
-
@w.errors.size.should == 1
|
94
|
-
@w.errors.first.message.should == "that's bad"
|
95
|
-
end
|
96
|
-
end
|