ibm_db 1.0.0 → 1.0.1

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.
@@ -15,6 +15,7 @@ require 'models/pirate'
15
15
  require 'models/treasure'
16
16
  require 'models/matey'
17
17
  require 'models/ship'
18
+ require 'models/book'
18
19
 
19
20
  class FixturesTest < ActiveRecord::TestCase
20
21
  self.use_instantiated_fixtures = true
@@ -377,6 +378,34 @@ class CheckSetTableNameFixturesTest < ActiveRecord::TestCase
377
378
  end
378
379
  end
379
380
 
381
+ class FixtureNameIsNotTableNameFixturesTest < ActiveRecord::TestCase
382
+ set_fixture_class :items => Book
383
+ fixtures :items
384
+ # Set to false to blow away fixtures cache and ensure our fixtures are loaded
385
+ # and thus takes into account our set_fixture_class
386
+ self.use_transactional_fixtures = false
387
+
388
+ def test_named_accessor
389
+ assert_kind_of Book, items(:dvd)
390
+ end
391
+ end
392
+
393
+ class FixtureNameIsNotTableNameMultipleFixturesTest < ActiveRecord::TestCase
394
+ set_fixture_class :items => Book, :funny_jokes => Joke
395
+ fixtures :items, :funny_jokes
396
+ # Set to false to blow away fixtures cache and ensure our fixtures are loaded
397
+ # and thus takes into account our set_fixture_class
398
+ self.use_transactional_fixtures = false
399
+
400
+ def test_named_accessor_of_differently_named_fixture
401
+ assert_kind_of Book, items(:dvd)
402
+ end
403
+
404
+ def test_named_accessor_of_same_named_fixture
405
+ assert_kind_of Joke, funny_jokes(:a_joke)
406
+ end
407
+ end
408
+
380
409
  class CustomConnectionFixturesTest < ActiveRecord::TestCase
381
410
  set_fixture_class :courses => Course
382
411
  fixtures :courses
@@ -436,11 +465,11 @@ class FixturesBrokenRollbackTest < ActiveRecord::TestCase
436
465
  alias_method :teardown, :blank_teardown
437
466
 
438
467
  def test_no_rollback_in_teardown_unless_transaction_active
439
- assert_equal 0, Thread.current['open_transactions']
468
+ assert_equal 0, ActiveRecord::Base.connection.open_transactions
440
469
  assert_raise(RuntimeError) { ar_setup_fixtures }
441
- assert_equal 0, Thread.current['open_transactions']
470
+ assert_equal 0, ActiveRecord::Base.connection.open_transactions
442
471
  assert_nothing_raised { ar_teardown_fixtures }
443
- assert_equal 0, Thread.current['open_transactions']
472
+ assert_equal 0, ActiveRecord::Base.connection.open_transactions
444
473
  end
445
474
 
446
475
  private
@@ -160,15 +160,16 @@ if ActiveRecord::Base.connection.supports_migrations?
160
160
  clasz.table_name = 'test_no_limits_datatypes_IBM_DB'
161
161
  assert_nothing_raised do
162
162
  clasz.connection.create_table clasz.table_name do |t|
163
- t.column "test_varchar", :string, :limit => 10
164
- t.column "test_integer", :integer, :limit => 5
165
- t.column "test_boolean", :boolean, :limit => 5
166
- t.column "test_double", :double, :limit => 10
167
- t.column "test_date", :date, :limit => 10
168
- t.column "test_time", :time, :limit => 10
169
- t.column "test_tstamp", :timestamp, :limit => 10
170
- t.column "test_xml", :xml, :limit => 10 unless ibm_ids
171
- t.column "test_clob", :text, :limit => 10000
163
+ t.column "test_varchar", :string, :limit => 10
164
+ t.column "test_integer", :integer, :limit => 5
165
+ t.column "test_boolean", :boolean, :limit => 5
166
+ t.column "test_double", :double, :limit => 10
167
+ t.column "test_date", :date, :limit => 10
168
+ t.column "test_time", :time, :limit => 10
169
+ t.column "test_tstamp", :timestamp, :limit => 10
170
+ t.column "test_xml", :xml, :limit => 10 unless ibm_ids
171
+ t.column "test_clob", :text, :limit => 10000
172
+ t.column "test_decfloat", :decfloat, :limit => 100
172
173
  end
173
174
  end
174
175
  ensure
@@ -176,20 +177,22 @@ if ActiveRecord::Base.connection.supports_migrations?
176
177
  end
177
178
 
178
179
  #Sexy migration test for column of type xml and char
179
- def test_short_hand_char_xml_migrations
180
+ def test_short_hand_migrations_for_ibm_db_datatypes
180
181
  ibm_ids = ActiveRecord::Base.connection.servertype.class.name.include?('::IBM_IDS')
181
182
  clasz = Class.new(ActiveRecord::Base)
182
183
  clasz.table_name = 'test_short_hand_migrations'
183
184
  assert_nothing_raised do
184
185
  clasz.connection.create_table clasz.table_name do |t|
185
- t.xml :xml_col unless ibm_ids
186
- t.char :char_col, :limit=>10
186
+ t.xml :xml_col unless ibm_ids
187
+ t.char :char_col, :limit=>10
188
+ t.decfloat :dec_col, :precision=>16
187
189
  end
188
190
  end
189
191
  assert_nothing_raised do
190
192
  clasz.connection.change_table clasz.table_name do |t|
191
- t.xml :xml_col1 unless ibm_ids
192
- t.char :char_col1, :limit=>50
193
+ t.xml :xml_col1 unless ibm_ids
194
+ t.char :char_col1, :limit=>50
195
+ t.decfloat :dec_col1, :precision=>34
193
196
  end
194
197
  end
195
198
  ensure
@@ -321,9 +324,9 @@ if ActiveRecord::Base.connection.supports_migrations?
321
324
  Person.connection.drop_table table_name rescue nil
322
325
  end
323
326
 
324
- # SQL Server, Sybase, and SQLite3 will not allow you to add a NOT NULL
327
+ # Sybase, and SQLite3 will not allow you to add a NOT NULL
325
328
  # column to a table without a default value.
326
- unless current_adapter?(:SQLServerAdapter, :SybaseAdapter, :SQLiteAdapter, :IBM_DBAdapter)
329
+ unless current_adapter?(:SybaseAdapter, :SQLiteAdapter, :IBM_DBAdapter)
327
330
  def test_add_column_not_null_without_default
328
331
  Person.connection.create_table :testings do |t|
329
332
  t.column :foo, :string
@@ -460,7 +463,7 @@ if ActiveRecord::Base.connection.supports_migrations?
460
463
  assert_equal Fixnum, bob.age.class
461
464
  assert_equal Time, bob.birthday.class
462
465
 
463
- if current_adapter?(:SQLServerAdapter, :OracleAdapter, :SybaseAdapter)
466
+ if current_adapter?(:OracleAdapter, :SybaseAdapter)
464
467
  # Sybase, and Oracle don't differentiate between date/time
465
468
  assert_equal Time, bob.favorite_day.class
466
469
  else
@@ -946,10 +949,6 @@ if ActiveRecord::Base.connection.supports_migrations?
946
949
  # - SQLite3 stores a float, in violation of SQL
947
950
  assert_kind_of BigDecimal, b.value_of_e
948
951
  assert_equal BigDecimal("2.71828182845905"), b.value_of_e
949
- elsif current_adapter?(:SQLServer)
950
- # - SQL Server rounds instead of truncating
951
- assert_kind_of Fixnum, b.value_of_e
952
- assert_equal 3, b.value_of_e
953
952
  else
954
953
  # - SQL standard is an integer
955
954
  unless current_adapter?(:IBM_DBAdapter) # incompatible types retrieved
@@ -1033,6 +1032,21 @@ if ActiveRecord::Base.connection.supports_migrations?
1033
1032
  assert_equal(0, ActiveRecord::Migrator.current_version)
1034
1033
  end
1035
1034
 
1035
+ if current_adapter?(:PostgreSQLAdapter)
1036
+ def test_migrator_one_up_with_exception_and_rollback
1037
+ assert !Person.column_methods_hash.include?(:last_name)
1038
+
1039
+ e = assert_raises(StandardError) do
1040
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/broken", 100)
1041
+ end
1042
+
1043
+ assert_equal "An error has occurred, this and all later migrations canceled:\n\nSomething broke", e.message
1044
+
1045
+ Person.reset_column_information
1046
+ assert !Person.column_methods_hash.include?(:last_name)
1047
+ end
1048
+ end
1049
+
1036
1050
  def test_finds_migrations
1037
1051
  migrations = ActiveRecord::Migrator.new(:up, MIGRATIONS_ROOT + "/valid").migrations
1038
1052
  [['1', 'people_have_last_names'],
@@ -1051,6 +1065,26 @@ if ActiveRecord::Base.connection.supports_migrations?
1051
1065
  migrations[0].name == 'innocent_jointable'
1052
1066
  end
1053
1067
 
1068
+ def test_only_loads_pending_migrations
1069
+ # migrate up to 1
1070
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid", 1)
1071
+
1072
+ # now unload the migrations that have been defined
1073
+ PeopleHaveLastNames.unloadable
1074
+ ActiveSupport::Dependencies.remove_unloadable_constants!
1075
+
1076
+ ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid", nil)
1077
+
1078
+ assert !defined? PeopleHaveLastNames
1079
+
1080
+ %w(WeNeedReminders, InnocentJointable).each do |migration|
1081
+ assert defined? migration
1082
+ end
1083
+
1084
+ ensure
1085
+ load(MIGRATIONS_ROOT + "/valid/1_people_have_last_names.rb")
1086
+ end
1087
+
1054
1088
  def test_migrator_interleaved_migrations
1055
1089
  ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/interleaved/pass_1")
1056
1090
 
@@ -1197,7 +1231,11 @@ if ActiveRecord::Base.connection.supports_migrations?
1197
1231
  columns = Person.connection.columns(:binary_testings)
1198
1232
  data_column = columns.detect { |c| c.name == "data" }
1199
1233
 
1200
- assert_nil data_column.default
1234
+ if current_adapter?(:MysqlAdapter)
1235
+ assert_equal '', data_column.default
1236
+ else
1237
+ assert_nil data_column.default
1238
+ end
1201
1239
 
1202
1240
  Person.connection.drop_table :binary_testings rescue nil
1203
1241
  end
@@ -496,6 +496,15 @@ class ValidationsTest < ActiveRecord::TestCase
496
496
  assert_not_equal "has already been taken", t3.errors.on(:title)
497
497
  end
498
498
 
499
+ def test_validate_case_sensitive_uniqueness_with_attribute_passed_as_integer
500
+ Topic.validates_uniqueness_of(:title, :case_sensitve => true)
501
+ t = Topic.create!('title' => 101)
502
+
503
+ t2 = Topic.new('title' => 101)
504
+ assert !t2.valid?
505
+ assert t2.errors.on(:title)
506
+ end
507
+
499
508
  def test_validate_uniqueness_with_non_standard_table_names
500
509
  i1 = WarehouseThing.create(:value => 1000)
501
510
  assert !i1.valid?, "i1 should not be valid"
@@ -603,7 +612,7 @@ class ValidationsTest < ActiveRecord::TestCase
603
612
  end
604
613
 
605
614
  def test_validate_format_with_formatted_message
606
- Topic.validates_format_of(:title, :with => /^Valid Title$/, :message => "can't be %s")
615
+ Topic.validates_format_of(:title, :with => /^Valid Title$/, :message => "can't be {{value}}")
607
616
  t = Topic.create(:title => 'Invalid title')
608
617
  assert_equal "can't be Invalid title", t.errors.on(:title)
609
618
  end
@@ -664,7 +673,7 @@ class ValidationsTest < ActiveRecord::TestCase
664
673
  end
665
674
 
666
675
  def test_validates_inclusion_of_with_formatted_message
667
- Topic.validates_inclusion_of( :title, :in => %w( a b c d e f g ), :message => "option %s is not in the list" )
676
+ Topic.validates_inclusion_of( :title, :in => %w( a b c d e f g ), :message => "option {{value}} is not in the list" )
668
677
 
669
678
  assert Topic.create("title" => "a", "content" => "abc").valid?
670
679
 
@@ -689,7 +698,7 @@ class ValidationsTest < ActiveRecord::TestCase
689
698
  end
690
699
 
691
700
  def test_validates_exclusion_of_with_formatted_message
692
- Topic.validates_exclusion_of( :title, :in => %w( abe monkey ), :message => "option %s is restricted" )
701
+ Topic.validates_exclusion_of( :title, :in => %w( abe monkey ), :message => "option {{value}} is restricted" )
693
702
 
694
703
  assert Topic.create("title" => "something", "content" => "abc")
695
704
 
@@ -789,7 +798,7 @@ class ValidationsTest < ActiveRecord::TestCase
789
798
  end
790
799
 
791
800
  def test_optionally_validates_length_of_using_within_on_create
792
- Topic.validates_length_of :title, :content, :within => 5..10, :on => :create, :too_long => "my string is too long: %d"
801
+ Topic.validates_length_of :title, :content, :within => 5..10, :on => :create, :too_long => "my string is too long: {{count}}"
793
802
 
794
803
  t = Topic.create("title" => "thisisnotvalid", "content" => "whatever")
795
804
  assert !t.save
@@ -810,7 +819,7 @@ class ValidationsTest < ActiveRecord::TestCase
810
819
  end
811
820
 
812
821
  def test_optionally_validates_length_of_using_within_on_update
813
- Topic.validates_length_of :title, :content, :within => 5..10, :on => :update, :too_short => "my string is too short: %d"
822
+ Topic.validates_length_of :title, :content, :within => 5..10, :on => :update, :too_short => "my string is too short: {{count}}"
814
823
 
815
824
  t = Topic.create("title" => "vali", "content" => "whatever")
816
825
  assert !t.save
@@ -872,7 +881,9 @@ class ValidationsTest < ActiveRecord::TestCase
872
881
  end
873
882
 
874
883
  def test_validates_length_with_globally_modified_error_message
875
- ActiveRecord::Errors.default_error_messages[:too_short] = 'tu est trops petit hombre %d'
884
+ ActiveSupport::Deprecation.silence do
885
+ ActiveRecord::Errors.default_error_messages[:too_short] = 'tu est trops petit hombre {{count}}'
886
+ end
876
887
  Topic.validates_length_of :title, :minimum => 10
877
888
  t = Topic.create(:title => 'too short')
878
889
  assert !t.valid?
@@ -915,7 +926,7 @@ class ValidationsTest < ActiveRecord::TestCase
915
926
  end
916
927
 
917
928
  def test_validates_length_of_custom_errors_for_minimum_with_message
918
- Topic.validates_length_of( :title, :minimum=>5, :message=>"boo %d" )
929
+ Topic.validates_length_of( :title, :minimum=>5, :message=>"boo {{count}}" )
919
930
  t = Topic.create("title" => "uhoh", "content" => "whatever")
920
931
  assert !t.valid?
921
932
  assert t.errors.on(:title)
@@ -923,7 +934,7 @@ class ValidationsTest < ActiveRecord::TestCase
923
934
  end
924
935
 
925
936
  def test_validates_length_of_custom_errors_for_minimum_with_too_short
926
- Topic.validates_length_of( :title, :minimum=>5, :too_short=>"hoo %d" )
937
+ Topic.validates_length_of( :title, :minimum=>5, :too_short=>"hoo {{count}}" )
927
938
  t = Topic.create("title" => "uhoh", "content" => "whatever")
928
939
  assert !t.valid?
929
940
  assert t.errors.on(:title)
@@ -931,7 +942,7 @@ class ValidationsTest < ActiveRecord::TestCase
931
942
  end
932
943
 
933
944
  def test_validates_length_of_custom_errors_for_maximum_with_message
934
- Topic.validates_length_of( :title, :maximum=>5, :message=>"boo %d" )
945
+ Topic.validates_length_of( :title, :maximum=>5, :message=>"boo {{count}}" )
935
946
  t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
936
947
  assert !t.valid?
937
948
  assert t.errors.on(:title)
@@ -939,7 +950,7 @@ class ValidationsTest < ActiveRecord::TestCase
939
950
  end
940
951
 
941
952
  def test_validates_length_of_custom_errors_for_maximum_with_too_long
942
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %d" )
953
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}" )
943
954
  t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
944
955
  assert !t.valid?
945
956
  assert t.errors.on(:title)
@@ -947,7 +958,7 @@ class ValidationsTest < ActiveRecord::TestCase
947
958
  end
948
959
 
949
960
  def test_validates_length_of_custom_errors_for_is_with_message
950
- Topic.validates_length_of( :title, :is=>5, :message=>"boo %d" )
961
+ Topic.validates_length_of( :title, :is=>5, :message=>"boo {{count}}" )
951
962
  t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
952
963
  assert !t.valid?
953
964
  assert t.errors.on(:title)
@@ -955,7 +966,7 @@ class ValidationsTest < ActiveRecord::TestCase
955
966
  end
956
967
 
957
968
  def test_validates_length_of_custom_errors_for_is_with_wrong_length
958
- Topic.validates_length_of( :title, :is=>5, :wrong_length=>"hoo %d" )
969
+ Topic.validates_length_of( :title, :is=>5, :wrong_length=>"hoo {{count}}" )
959
970
  t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
960
971
  assert !t.valid?
961
972
  assert t.errors.on(:title)
@@ -1021,7 +1032,7 @@ class ValidationsTest < ActiveRecord::TestCase
1021
1032
 
1022
1033
  def test_optionally_validates_length_of_using_within_on_create_utf8
1023
1034
  with_kcode('UTF8') do
1024
- Topic.validates_length_of :title, :within => 5..10, :on => :create, :too_long => "長すぎます: %d"
1035
+ Topic.validates_length_of :title, :within => 5..10, :on => :create, :too_long => "長すぎます: {{count}}"
1025
1036
 
1026
1037
  t = Topic.create("title" => "一二三四五六七八九十A", "content" => "whatever")
1027
1038
  assert !t.save
@@ -1044,7 +1055,7 @@ class ValidationsTest < ActiveRecord::TestCase
1044
1055
 
1045
1056
  def test_optionally_validates_length_of_using_within_on_update_utf8
1046
1057
  with_kcode('UTF8') do
1047
- Topic.validates_length_of :title, :within => 5..10, :on => :update, :too_short => "短すぎます: %d"
1058
+ Topic.validates_length_of :title, :within => 5..10, :on => :update, :too_short => "短すぎます: {{count}}"
1048
1059
 
1049
1060
  t = Topic.create("title" => "一二三4", "content" => "whatever")
1050
1061
  assert !t.save
@@ -1079,7 +1090,7 @@ class ValidationsTest < ActiveRecord::TestCase
1079
1090
  end
1080
1091
 
1081
1092
  def test_validates_length_of_with_block
1082
- Topic.validates_length_of :content, :minimum => 5, :too_short=>"Your essay must be at least %d words.",
1093
+ Topic.validates_length_of :content, :minimum => 5, :too_short=>"Your essay must be at least {{count}} words.",
1083
1094
  :tokenizer => lambda {|str| str.scan(/\w+/) }
1084
1095
  t = Topic.create!(:content => "this content should be long enough")
1085
1096
  assert t.valid?
@@ -1230,7 +1241,7 @@ class ValidationsTest < ActiveRecord::TestCase
1230
1241
 
1231
1242
  def test_if_validation_using_method_true
1232
1243
  # When the method returns true
1233
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %d", :if => :condition_is_true )
1244
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}", :if => :condition_is_true )
1234
1245
  t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
1235
1246
  assert !t.valid?
1236
1247
  assert t.errors.on(:title)
@@ -1239,7 +1250,7 @@ class ValidationsTest < ActiveRecord::TestCase
1239
1250
 
1240
1251
  def test_unless_validation_using_method_true
1241
1252
  # When the method returns true
1242
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %d", :unless => :condition_is_true )
1253
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}", :unless => :condition_is_true )
1243
1254
  t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
1244
1255
  assert t.valid?
1245
1256
  assert !t.errors.on(:title)
@@ -1247,7 +1258,7 @@ class ValidationsTest < ActiveRecord::TestCase
1247
1258
 
1248
1259
  def test_if_validation_using_method_false
1249
1260
  # When the method returns false
1250
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %d", :if => :condition_is_true_but_its_not )
1261
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}", :if => :condition_is_true_but_its_not )
1251
1262
  t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
1252
1263
  assert t.valid?
1253
1264
  assert !t.errors.on(:title)
@@ -1255,7 +1266,7 @@ class ValidationsTest < ActiveRecord::TestCase
1255
1266
 
1256
1267
  def test_unless_validation_using_method_false
1257
1268
  # When the method returns false
1258
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %d", :unless => :condition_is_true_but_its_not )
1269
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}", :unless => :condition_is_true_but_its_not )
1259
1270
  t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
1260
1271
  assert !t.valid?
1261
1272
  assert t.errors.on(:title)
@@ -1264,7 +1275,7 @@ class ValidationsTest < ActiveRecord::TestCase
1264
1275
 
1265
1276
  def test_if_validation_using_string_true
1266
1277
  # When the evaluated string returns true
1267
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %d", :if => "a = 1; a == 1" )
1278
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}", :if => "a = 1; a == 1" )
1268
1279
  t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
1269
1280
  assert !t.valid?
1270
1281
  assert t.errors.on(:title)
@@ -1273,7 +1284,7 @@ class ValidationsTest < ActiveRecord::TestCase
1273
1284
 
1274
1285
  def test_unless_validation_using_string_true
1275
1286
  # When the evaluated string returns true
1276
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %d", :unless => "a = 1; a == 1" )
1287
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}", :unless => "a = 1; a == 1" )
1277
1288
  t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
1278
1289
  assert t.valid?
1279
1290
  assert !t.errors.on(:title)
@@ -1281,7 +1292,7 @@ class ValidationsTest < ActiveRecord::TestCase
1281
1292
 
1282
1293
  def test_if_validation_using_string_false
1283
1294
  # When the evaluated string returns false
1284
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %d", :if => "false")
1295
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}", :if => "false")
1285
1296
  t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
1286
1297
  assert t.valid?
1287
1298
  assert !t.errors.on(:title)
@@ -1289,7 +1300,7 @@ class ValidationsTest < ActiveRecord::TestCase
1289
1300
 
1290
1301
  def test_unless_validation_using_string_false
1291
1302
  # When the evaluated string returns false
1292
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %d", :unless => "false")
1303
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}", :unless => "false")
1293
1304
  t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
1294
1305
  assert !t.valid?
1295
1306
  assert t.errors.on(:title)
@@ -1298,7 +1309,7 @@ class ValidationsTest < ActiveRecord::TestCase
1298
1309
 
1299
1310
  def test_if_validation_using_block_true
1300
1311
  # When the block returns true
1301
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %d",
1312
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}",
1302
1313
  :if => Proc.new { |r| r.content.size > 4 } )
1303
1314
  t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
1304
1315
  assert !t.valid?
@@ -1308,7 +1319,7 @@ class ValidationsTest < ActiveRecord::TestCase
1308
1319
 
1309
1320
  def test_unless_validation_using_block_true
1310
1321
  # When the block returns true
1311
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %d",
1322
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}",
1312
1323
  :unless => Proc.new { |r| r.content.size > 4 } )
1313
1324
  t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
1314
1325
  assert t.valid?
@@ -1317,7 +1328,7 @@ class ValidationsTest < ActiveRecord::TestCase
1317
1328
 
1318
1329
  def test_if_validation_using_block_false
1319
1330
  # When the block returns false
1320
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %d",
1331
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}",
1321
1332
  :if => Proc.new { |r| r.title != "uhohuhoh"} )
1322
1333
  t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
1323
1334
  assert t.valid?
@@ -1326,7 +1337,7 @@ class ValidationsTest < ActiveRecord::TestCase
1326
1337
 
1327
1338
  def test_unless_validation_using_block_false
1328
1339
  # When the block returns false
1329
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %d",
1340
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}",
1330
1341
  :unless => Proc.new { |r| r.title != "uhohuhoh"} )
1331
1342
  t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
1332
1343
  assert !t.valid?
@@ -1428,8 +1439,8 @@ class ValidatesNumericalityTest < ActiveRecord::TestCase
1428
1439
  def test_validates_numericality_of_with_nil_allowed
1429
1440
  Topic.validates_numericality_of :approved, :allow_nil => true
1430
1441
 
1431
- invalid!(BLANK + JUNK)
1432
- valid!(NIL + FLOATS + INTEGERS + BIGDECIMAL + INFINITY)
1442
+ invalid!(JUNK)
1443
+ valid!(NIL + BLANK + FLOATS + INTEGERS + BIGDECIMAL + INFINITY)
1433
1444
  end
1434
1445
 
1435
1446
  def test_validates_numericality_of_with_integer_only
@@ -1442,8 +1453,8 @@ class ValidatesNumericalityTest < ActiveRecord::TestCase
1442
1453
  def test_validates_numericality_of_with_integer_only_and_nil_allowed
1443
1454
  Topic.validates_numericality_of :approved, :only_integer => true, :allow_nil => true
1444
1455
 
1445
- invalid!(BLANK + JUNK + FLOATS + BIGDECIMAL + INFINITY)
1446
- valid!(NIL + INTEGERS)
1456
+ invalid!(JUNK + FLOATS + BIGDECIMAL + INFINITY)
1457
+ valid!(NIL + BLANK + INTEGERS)
1447
1458
  end
1448
1459
 
1449
1460
  def test_validates_numericality_with_greater_than
@@ -1503,13 +1514,13 @@ class ValidatesNumericalityTest < ActiveRecord::TestCase
1503
1514
  end
1504
1515
 
1505
1516
  def test_validates_numericality_with_numeric_message
1506
- Topic.validates_numericality_of :approved, :less_than => 4, :message => "smaller than %d"
1517
+ Topic.validates_numericality_of :approved, :less_than => 4, :message => "smaller than {{count}}"
1507
1518
  topic = Topic.new("title" => "numeric test", "approved" => 10)
1508
1519
 
1509
1520
  assert !topic.valid?
1510
1521
  assert_equal "smaller than 4", topic.errors.on(:approved)
1511
1522
 
1512
- Topic.validates_numericality_of :approved, :greater_than => 4, :message => "greater than %d"
1523
+ Topic.validates_numericality_of :approved, :greater_than => 4, :message => "greater than {{count}}"
1513
1524
  topic = Topic.new("title" => "numeric test", "approved" => 1)
1514
1525
 
1515
1526
  assert !topic.valid?
@@ -60,7 +60,7 @@ ActiveRecord::Schema.define do
60
60
  end
61
61
 
62
62
  create_table :booleantests, :force => true do |t|
63
- t.integer :value
63
+ t.boolean :value
64
64
  end
65
65
 
66
66
  create_table :categories, :force => true do |t|
@@ -105,6 +105,7 @@ ActiveRecord::Schema.define do
105
105
  t.string :type
106
106
  t.string :ruby_type
107
107
  t.integer :firm_id
108
+ t.string :firm_name
108
109
  t.string :name
109
110
  t.integer :client_of
110
111
  t.integer :rating, :default => 1
@@ -128,7 +129,7 @@ ActiveRecord::Schema.define do
128
129
  create_table :developers, :force => true do |t|
129
130
  t.string :name
130
131
  t.integer :salary, :default => 70000
131
- t.datetime :created_at
132
+ t.timestamp :created_at
132
133
  t.datetime :updated_at
133
134
  end
134
135
 
@@ -200,6 +201,12 @@ ActiveRecord::Schema.define do
200
201
  t.string :name
201
202
  end
202
203
 
204
+ create_table :member_details, :force => true do |t|
205
+ t.integer :member_id
206
+ t.integer :organization_id
207
+ t.string :extra_data
208
+ end
209
+
203
210
  create_table :memberships, :force => true do |t|
204
211
  t.datetime :joined_on
205
212
  t.integer :club_id, :member_id
@@ -252,6 +259,10 @@ ActiveRecord::Schema.define do
252
259
  t.integer :shipping_customer_id
253
260
  end
254
261
 
262
+ create_table :organizations, :force => true do |t|
263
+ t.string :name
264
+ end
265
+
255
266
  create_table :owners, :primary_key => :owner_id ,:force => true do |t|
256
267
  t.string :name
257
268
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ibm_db
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - IBM
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-05 00:00:00 +05:30
12
+ date: 2008-12-18 00:00:00 +05:30
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency