sequel 0.5.0.2 → 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/COPYING +18 -18
  2. data/Rakefile +17 -98
  3. data/lib/sequel.rb +2 -71
  4. metadata +10 -108
  5. data/CHANGELOG +0 -989
  6. data/bin/sequel +0 -41
  7. data/lib/sequel/adapters/adapter_skeleton.rb +0 -68
  8. data/lib/sequel/adapters/ado.rb +0 -100
  9. data/lib/sequel/adapters/db2.rb +0 -158
  10. data/lib/sequel/adapters/dbi.rb +0 -126
  11. data/lib/sequel/adapters/informix.rb +0 -87
  12. data/lib/sequel/adapters/jdbc.rb +0 -108
  13. data/lib/sequel/adapters/mysql.rb +0 -269
  14. data/lib/sequel/adapters/odbc.rb +0 -145
  15. data/lib/sequel/adapters/odbc_mssql.rb +0 -93
  16. data/lib/sequel/adapters/openbase.rb +0 -90
  17. data/lib/sequel/adapters/oracle.rb +0 -99
  18. data/lib/sequel/adapters/postgres.rb +0 -519
  19. data/lib/sequel/adapters/sqlite.rb +0 -192
  20. data/lib/sequel/ado.rb +0 -6
  21. data/lib/sequel/array_keys.rb +0 -296
  22. data/lib/sequel/connection_pool.rb +0 -152
  23. data/lib/sequel/core_ext.rb +0 -59
  24. data/lib/sequel/core_sql.rb +0 -191
  25. data/lib/sequel/database.rb +0 -433
  26. data/lib/sequel/dataset.rb +0 -409
  27. data/lib/sequel/dataset/convenience.rb +0 -321
  28. data/lib/sequel/dataset/sequelizer.rb +0 -354
  29. data/lib/sequel/dataset/sql.rb +0 -586
  30. data/lib/sequel/db2.rb +0 -6
  31. data/lib/sequel/dbi.rb +0 -6
  32. data/lib/sequel/exceptions.rb +0 -45
  33. data/lib/sequel/informix.rb +0 -6
  34. data/lib/sequel/migration.rb +0 -191
  35. data/lib/sequel/model.rb +0 -8
  36. data/lib/sequel/mysql.rb +0 -6
  37. data/lib/sequel/odbc.rb +0 -6
  38. data/lib/sequel/oracle.rb +0 -6
  39. data/lib/sequel/postgres.rb +0 -6
  40. data/lib/sequel/pretty_table.rb +0 -73
  41. data/lib/sequel/schema.rb +0 -8
  42. data/lib/sequel/schema/schema_generator.rb +0 -131
  43. data/lib/sequel/schema/schema_sql.rb +0 -131
  44. data/lib/sequel/sqlite.rb +0 -6
  45. data/lib/sequel/worker.rb +0 -58
  46. data/spec/adapters/informix_spec.rb +0 -139
  47. data/spec/adapters/mysql_spec.rb +0 -330
  48. data/spec/adapters/oracle_spec.rb +0 -130
  49. data/spec/adapters/postgres_spec.rb +0 -189
  50. data/spec/adapters/sqlite_spec.rb +0 -345
  51. data/spec/array_keys_spec.rb +0 -679
  52. data/spec/connection_pool_spec.rb +0 -356
  53. data/spec/core_ext_spec.rb +0 -67
  54. data/spec/core_sql_spec.rb +0 -301
  55. data/spec/database_spec.rb +0 -811
  56. data/spec/dataset_spec.rb +0 -2381
  57. data/spec/migration_spec.rb +0 -261
  58. data/spec/pretty_table_spec.rb +0 -66
  59. data/spec/rcov.opts +0 -4
  60. data/spec/schema_generator_spec.rb +0 -86
  61. data/spec/schema_spec.rb +0 -230
  62. data/spec/sequel_spec.rb +0 -10
  63. data/spec/sequelizer_spec.rb +0 -389
  64. data/spec/spec.opts +0 -5
  65. data/spec/spec_helper.rb +0 -44
  66. 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