sequel 2.10.0 → 2.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/CHANGELOG +51 -1
  2. data/README.rdoc +2 -2
  3. data/Rakefile +2 -2
  4. data/doc/advanced_associations.rdoc +6 -18
  5. data/doc/release_notes/1.0.txt +38 -0
  6. data/doc/release_notes/1.1.txt +143 -0
  7. data/doc/release_notes/1.3.txt +101 -0
  8. data/doc/release_notes/1.4.0.txt +53 -0
  9. data/doc/release_notes/1.5.0.txt +155 -0
  10. data/doc/release_notes/2.0.0.txt +298 -0
  11. data/doc/release_notes/2.1.0.txt +271 -0
  12. data/doc/release_notes/2.10.0.txt +328 -0
  13. data/doc/release_notes/2.11.0.txt +215 -0
  14. data/doc/release_notes/2.2.0.txt +253 -0
  15. data/doc/release_notes/2.3.0.txt +88 -0
  16. data/doc/release_notes/2.4.0.txt +106 -0
  17. data/doc/release_notes/2.5.0.txt +137 -0
  18. data/doc/release_notes/2.6.0.txt +157 -0
  19. data/doc/release_notes/2.7.0.txt +166 -0
  20. data/doc/release_notes/2.8.0.txt +171 -0
  21. data/doc/release_notes/2.9.0.txt +97 -0
  22. data/lib/sequel_core/adapters/ado.rb +3 -0
  23. data/lib/sequel_core/adapters/db2.rb +0 -11
  24. data/lib/sequel_core/adapters/dbi.rb +0 -11
  25. data/lib/sequel_core/adapters/do.rb +0 -12
  26. data/lib/sequel_core/adapters/firebird.rb +21 -16
  27. data/lib/sequel_core/adapters/informix.rb +1 -11
  28. data/lib/sequel_core/adapters/jdbc.rb +1 -13
  29. data/lib/sequel_core/adapters/jdbc/h2.rb +3 -11
  30. data/lib/sequel_core/adapters/jdbc/mysql.rb +0 -17
  31. data/lib/sequel_core/adapters/jdbc/postgresql.rb +3 -15
  32. data/lib/sequel_core/adapters/mysql.rb +31 -27
  33. data/lib/sequel_core/adapters/odbc.rb +34 -28
  34. data/lib/sequel_core/adapters/openbase.rb +0 -11
  35. data/lib/sequel_core/adapters/oracle.rb +11 -9
  36. data/lib/sequel_core/adapters/postgres.rb +14 -17
  37. data/lib/sequel_core/adapters/shared/mssql.rb +6 -15
  38. data/lib/sequel_core/adapters/shared/mysql.rb +29 -14
  39. data/lib/sequel_core/adapters/shared/oracle.rb +4 -0
  40. data/lib/sequel_core/adapters/shared/postgres.rb +30 -35
  41. data/lib/sequel_core/adapters/shared/progress.rb +4 -0
  42. data/lib/sequel_core/adapters/shared/sqlite.rb +73 -13
  43. data/lib/sequel_core/adapters/sqlite.rb +8 -18
  44. data/lib/sequel_core/adapters/utils/date_format.rb +21 -0
  45. data/lib/sequel_core/{dataset → adapters/utils}/stored_procedures.rb +0 -0
  46. data/lib/sequel_core/{dataset → adapters/utils}/unsupported.rb +0 -0
  47. data/lib/sequel_core/core_ext.rb +1 -1
  48. data/lib/sequel_core/core_sql.rb +9 -4
  49. data/lib/sequel_core/database.rb +63 -62
  50. data/lib/sequel_core/dataset.rb +9 -4
  51. data/lib/sequel_core/dataset/convenience.rb +10 -9
  52. data/lib/sequel_core/dataset/prepared_statements.rb +1 -1
  53. data/lib/sequel_core/dataset/sql.rb +130 -36
  54. data/lib/sequel_core/schema/sql.rb +2 -2
  55. data/lib/sequel_core/sql.rb +44 -51
  56. data/lib/sequel_core/version.rb +1 -1
  57. data/lib/sequel_model/associations.rb +25 -17
  58. data/lib/sequel_model/base.rb +35 -7
  59. data/lib/sequel_model/caching.rb +1 -6
  60. data/lib/sequel_model/record.rb +23 -5
  61. data/lib/sequel_model/validations.rb +20 -5
  62. data/spec/adapters/firebird_spec.rb +6 -1
  63. data/spec/adapters/mysql_spec.rb +12 -0
  64. data/spec/adapters/postgres_spec.rb +2 -2
  65. data/spec/adapters/sqlite_spec.rb +81 -2
  66. data/spec/integration/dataset_test.rb +2 -2
  67. data/spec/integration/type_test.rb +12 -2
  68. data/spec/sequel_core/core_sql_spec.rb +46 -12
  69. data/spec/sequel_core/database_spec.rb +24 -12
  70. data/spec/sequel_core/dataset_spec.rb +82 -32
  71. data/spec/sequel_core/schema_spec.rb +16 -0
  72. data/spec/sequel_model/associations_spec.rb +89 -0
  73. data/spec/sequel_model/base_spec.rb +66 -0
  74. data/spec/sequel_model/eager_loading_spec.rb +32 -0
  75. data/spec/sequel_model/record_spec.rb +9 -9
  76. data/spec/sequel_model/spec_helper.rb +3 -0
  77. data/spec/sequel_model/validations_spec.rb +63 -3
  78. metadata +41 -4
@@ -968,7 +968,7 @@ describe Sequel::Model, "typecasting" do
968
968
 
969
969
  specify "should raise an error if invalid data is used in an integer field" do
970
970
  @c.instance_variable_set(:@db_schema, {:x=>{:type=>:integer}})
971
- proc{@c.new.x = 'a'}.should raise_error
971
+ proc{@c.new.x = 'a'}.should raise_error(Sequel::Error::InvalidValue)
972
972
  end
973
973
 
974
974
  specify "should assign value if raise_on_typecast_failure is off and assigning invalid integer" do
@@ -992,7 +992,7 @@ describe Sequel::Model, "typecasting" do
992
992
 
993
993
  specify "should raise an error if invalid data is used in an float field" do
994
994
  @c.instance_variable_set(:@db_schema, {:x=>{:type=>:float}})
995
- proc{@c.new.x = 'a'}.should raise_error
995
+ proc{@c.new.x = 'a'}.should raise_error(Sequel::Error::InvalidValue)
996
996
  end
997
997
 
998
998
  specify "should assign value if raise_on_typecast_failure is off and assigning invalid float" do
@@ -1019,7 +1019,7 @@ describe Sequel::Model, "typecasting" do
1019
1019
 
1020
1020
  specify "should raise an error if invalid data is used in an decimal field" do
1021
1021
  @c.instance_variable_set(:@db_schema, {:x=>{:type=>:decimal}})
1022
- proc{@c.new.x = Date.today}.should raise_error
1022
+ proc{@c.new.x = Date.today}.should raise_error(Sequel::Error::InvalidValue)
1023
1023
  end
1024
1024
 
1025
1025
  specify "should assign value if raise_on_typecast_failure is off and assigning invalid decimal" do
@@ -1095,8 +1095,8 @@ describe Sequel::Model, "typecasting" do
1095
1095
 
1096
1096
  specify "should raise an error if invalid data is used in a date field" do
1097
1097
  @c.instance_variable_set(:@db_schema, {:x=>{:type=>:date}})
1098
- proc{@c.new.x = 'a'}.should raise_error
1099
- proc{@c.new.x = 100}.should raise_error
1098
+ proc{@c.new.x = 'a'}.should raise_error(Sequel::Error::InvalidValue)
1099
+ proc{@c.new.x = 100}.should raise_error(Sequel::Error::InvalidValue)
1100
1100
  end
1101
1101
 
1102
1102
  specify "should assign value if raise_on_typecast_failure is off and assigning invalid date" do
@@ -1122,8 +1122,8 @@ describe Sequel::Model, "typecasting" do
1122
1122
  @c.instance_variable_set(:@db_schema, {:x=>{:type=>:time}})
1123
1123
  proc{@c.new.x = '0000'}.should raise_error
1124
1124
  proc{@c.new.x = 'a'}.should_not raise_error # Valid Time
1125
- proc{@c.new.x = '2008-10-21'.to_date}.should raise_error
1126
- proc{@c.new.x = '2008-10-21'.to_datetime}.should raise_error
1125
+ proc{@c.new.x = '2008-10-21'.to_date}.should raise_error(Sequel::Error::InvalidValue)
1126
+ proc{@c.new.x = '2008-10-21'.to_datetime}.should raise_error(Sequel::Error::InvalidValue)
1127
1127
  end
1128
1128
 
1129
1129
  specify "should assign value if raise_on_typecast_failure is off and assigning invalid time" do
@@ -1164,8 +1164,8 @@ describe Sequel::Model, "typecasting" do
1164
1164
  proc{@c.new.x = '0000'}.should raise_error(Sequel::Error::InvalidValue)
1165
1165
  proc{@c.new.x = 'a'}.should_not raise_error # Valid Time
1166
1166
  Sequel.datetime_class = DateTime
1167
- proc{@c.new.x = '0000'}.should raise_error
1168
- proc{@c.new.x = 'a'}.should raise_error
1167
+ proc{@c.new.x = '0000'}.should raise_error(Sequel::Error::InvalidValue)
1168
+ proc{@c.new.x = 'a'}.should raise_error(Sequel::Error::InvalidValue)
1169
1169
  end
1170
1170
 
1171
1171
  specify "should assign value if raise_on_typecast_failure is off and assigning invalid datetime" do
@@ -73,6 +73,9 @@ class << Sequel::Model
73
73
  @db_schema = {}
74
74
  cols.each{|c| @db_schema[c] = {}}
75
75
  end
76
+ def simple_table
77
+ nil
78
+ end
76
79
  end
77
80
 
78
81
  Sequel::Model.db = MODEL_DB = MockDatabase.new
@@ -540,6 +540,50 @@ describe Sequel::Model do
540
540
  @m.value = false
541
541
  @m.should be_valid
542
542
  end
543
+
544
+ specify "should validate inclusion_of with an array" do
545
+ @c.validates_inclusion_of :value, :in => [1,2]
546
+ @m.should_not be_valid
547
+ @m.value = 1
548
+ @m.should be_valid
549
+ @m.value = 1.5
550
+ @m.should_not be_valid
551
+ @m.value = 2
552
+ @m.should be_valid
553
+ @m.value = 3
554
+ @m.should_not be_valid
555
+ end
556
+
557
+ specify "should validate inclusion_of with a range" do
558
+ @c.validates_inclusion_of :value, :in => 1..4
559
+ @m.should_not be_valid
560
+ @m.value = 1
561
+ @m.should be_valid
562
+ @m.value = 1.5
563
+ @m.should be_valid
564
+ @m.value = 0
565
+ @m.should_not be_valid
566
+ @m.value = 5
567
+ @m.should_not be_valid
568
+ end
569
+
570
+ specify "should raise an error if inclusion_of doesn't receive a valid :in option" do
571
+ lambda {
572
+ @c.validates_inclusion_of :value
573
+ }.should raise_error(ArgumentError)
574
+
575
+ lambda {
576
+ @c.validates_inclusion_of :value, :in => 1
577
+ }.should raise_error(ArgumentError)
578
+ end
579
+
580
+ specify "should raise an error if inclusion_of handles :allow_nil too" do
581
+ @c.validates_inclusion_of :value, :in => 1..4, :allow_nil => true
582
+ @m.value = nil
583
+ @m.should be_valid
584
+ @m.value = 0
585
+ @m.should_not be_valid
586
+ end
543
587
 
544
588
  specify "should validate presence_of with if => true" do
545
589
  @c.validates_presence_of :value, :if => :dont_skip
@@ -750,21 +794,37 @@ describe Sequel::Model, "Validations" do
750
794
  it "should validate that a column doesn't have a string value" do
751
795
  p = Class.new(Sequel::Model)
752
796
  p.class_eval do
753
- columns :age
797
+ columns :age, :price, :confirmed
754
798
  self.raise_on_typecast_failure = false
755
799
  validates_not_string :age
800
+ validates_not_string :confirmed
801
+ validates_not_string :price, :message=>'is not valid'
756
802
  @db_schema = {:age=>{:type=>:integer}}
757
803
  end
758
804
 
759
- @person = p.new :age => "a"
805
+ @person = p.new
806
+ @person.should be_valid
807
+
808
+ @person.confirmed = 't'
809
+ @person.should_not be_valid
810
+ @person.errors.full_messages.should == ['confirmed is a string']
811
+ @person.confirmed = true
812
+ @person.should be_valid
813
+
814
+ @person.age = 'a'
760
815
  @person.should_not be_valid
761
816
  @person.errors.full_messages.should == ['age is not a valid integer']
762
817
  @person.db_schema[:age][:type] = :datetime
763
818
  @person.should_not be_valid
764
819
  @person.errors.full_messages.should == ['age is not a valid datetime']
765
-
766
820
  @person.age = 20
767
821
  @person.should be_valid
822
+
823
+ @person.price = 'a'
824
+ @person.should_not be_valid
825
+ @person.errors.full_messages.should == ['price is not valid']
826
+ @person.price = 20
827
+ @person.should be_valid
768
828
  end
769
829
 
770
830
  it "should validate numericality of column" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.0
4
+ version: 2.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-03 00:00:00 -08:00
12
+ date: 2009-03-02 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -29,6 +29,23 @@ extra_rdoc_files:
29
29
  - doc/prepared_statements.rdoc
30
30
  - doc/schema.rdoc
31
31
  - doc/sharding.rdoc
32
+ - doc/release_notes/2.10.0.txt
33
+ - doc/release_notes/2.9.0.txt
34
+ - doc/release_notes/2.8.0.txt
35
+ - doc/release_notes/2.7.0.txt
36
+ - doc/release_notes/2.6.0.txt
37
+ - doc/release_notes/2.5.0.txt
38
+ - doc/release_notes/2.4.0.txt
39
+ - doc/release_notes/2.3.0.txt
40
+ - doc/release_notes/2.2.0.txt
41
+ - doc/release_notes/2.1.0.txt
42
+ - doc/release_notes/2.0.0.txt
43
+ - doc/release_notes/1.5.0.txt
44
+ - doc/release_notes/1.4.0.txt
45
+ - doc/release_notes/1.1.txt
46
+ - doc/release_notes/1.3.txt
47
+ - doc/release_notes/1.0.txt
48
+ - doc/release_notes/2.11.0.txt
32
49
  files:
33
50
  - COPYING
34
51
  - CHANGELOG
@@ -41,6 +58,24 @@ files:
41
58
  - doc/prepared_statements.rdoc
42
59
  - doc/schema.rdoc
43
60
  - doc/sharding.rdoc
61
+ - doc/release_notes
62
+ - doc/release_notes/2.10.0.txt
63
+ - doc/release_notes/2.9.0.txt
64
+ - doc/release_notes/2.8.0.txt
65
+ - doc/release_notes/2.7.0.txt
66
+ - doc/release_notes/2.6.0.txt
67
+ - doc/release_notes/2.5.0.txt
68
+ - doc/release_notes/2.4.0.txt
69
+ - doc/release_notes/2.3.0.txt
70
+ - doc/release_notes/2.2.0.txt
71
+ - doc/release_notes/2.1.0.txt
72
+ - doc/release_notes/2.0.0.txt
73
+ - doc/release_notes/1.5.0.txt
74
+ - doc/release_notes/1.4.0.txt
75
+ - doc/release_notes/1.1.txt
76
+ - doc/release_notes/1.3.txt
77
+ - doc/release_notes/1.0.txt
78
+ - doc/release_notes/2.11.0.txt
44
79
  - spec/adapters
45
80
  - spec/adapters/ado_spec.rb
46
81
  - spec/adapters/informix_spec.rb
@@ -124,6 +159,10 @@ files:
124
159
  - lib/sequel_core/adapters/do/postgres.rb
125
160
  - lib/sequel_core/adapters/do/sqlite.rb
126
161
  - lib/sequel_core/adapters/firebird.rb
162
+ - lib/sequel_core/adapters/utils
163
+ - lib/sequel_core/adapters/utils/date_format.rb
164
+ - lib/sequel_core/adapters/utils/stored_procedures.rb
165
+ - lib/sequel_core/adapters/utils/unsupported.rb
127
166
  - lib/sequel_core/connection_pool.rb
128
167
  - lib/sequel_core/core_ext.rb
129
168
  - lib/sequel_core/core_sql.rb
@@ -139,8 +178,6 @@ files:
139
178
  - lib/sequel_core/dataset/query.rb
140
179
  - lib/sequel_core/dataset/schema.rb
141
180
  - lib/sequel_core/dataset/sql.rb
142
- - lib/sequel_core/dataset/unsupported.rb
143
- - lib/sequel_core/dataset/stored_procedures.rb
144
181
  - lib/sequel_core/deprecated.rb
145
182
  - lib/sequel_core/exceptions.rb
146
183
  - lib/sequel_core/migration.rb