sequel 3.48.0 → 4.0.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG +114 -0
- data/Rakefile +10 -7
- data/doc/association_basics.rdoc +25 -23
- data/doc/code_order.rdoc +7 -0
- data/doc/core_extensions.rdoc +0 -10
- data/doc/object_model.rdoc +4 -1
- data/doc/querying.rdoc +3 -3
- data/doc/release_notes/4.0.0.txt +262 -0
- data/doc/security.rdoc +0 -28
- data/doc/testing.rdoc +8 -14
- data/lib/sequel/adapters/ado.rb +7 -11
- data/lib/sequel/adapters/ado/access.rb +8 -8
- data/lib/sequel/adapters/ado/mssql.rb +4 -4
- data/lib/sequel/adapters/amalgalite.rb +6 -6
- data/lib/sequel/adapters/cubrid.rb +7 -7
- data/lib/sequel/adapters/db2.rb +5 -9
- data/lib/sequel/adapters/dbi.rb +2 -6
- data/lib/sequel/adapters/do.rb +4 -4
- data/lib/sequel/adapters/firebird.rb +4 -4
- data/lib/sequel/adapters/ibmdb.rb +8 -8
- data/lib/sequel/adapters/informix.rb +2 -10
- data/lib/sequel/adapters/jdbc.rb +17 -17
- data/lib/sequel/adapters/jdbc/as400.rb +2 -2
- data/lib/sequel/adapters/jdbc/cubrid.rb +1 -1
- data/lib/sequel/adapters/jdbc/db2.rb +1 -1
- data/lib/sequel/adapters/jdbc/derby.rb +1 -1
- data/lib/sequel/adapters/jdbc/h2.rb +2 -2
- data/lib/sequel/adapters/jdbc/hsqldb.rb +1 -1
- data/lib/sequel/adapters/jdbc/informix.rb +1 -1
- data/lib/sequel/adapters/jdbc/mssql.rb +2 -2
- data/lib/sequel/adapters/jdbc/mysql.rb +1 -1
- data/lib/sequel/adapters/jdbc/oracle.rb +5 -1
- data/lib/sequel/adapters/jdbc/postgresql.rb +3 -3
- data/lib/sequel/adapters/jdbc/sqlite.rb +3 -3
- data/lib/sequel/adapters/jdbc/transactions.rb +3 -3
- data/lib/sequel/adapters/mock.rb +7 -7
- data/lib/sequel/adapters/mysql.rb +3 -3
- data/lib/sequel/adapters/mysql2.rb +4 -4
- data/lib/sequel/adapters/odbc.rb +2 -6
- data/lib/sequel/adapters/odbc/mssql.rb +1 -1
- data/lib/sequel/adapters/openbase.rb +1 -5
- data/lib/sequel/adapters/oracle.rb +13 -17
- data/lib/sequel/adapters/postgres.rb +20 -25
- data/lib/sequel/adapters/shared/cubrid.rb +3 -3
- data/lib/sequel/adapters/shared/db2.rb +2 -2
- data/lib/sequel/adapters/shared/firebird.rb +7 -7
- data/lib/sequel/adapters/shared/mssql.rb +9 -9
- data/lib/sequel/adapters/shared/mysql.rb +29 -13
- data/lib/sequel/adapters/shared/mysql_prepared_statements.rb +7 -7
- data/lib/sequel/adapters/shared/oracle.rb +22 -13
- data/lib/sequel/adapters/shared/postgres.rb +61 -46
- data/lib/sequel/adapters/shared/sqlite.rb +9 -9
- data/lib/sequel/adapters/sqlite.rb +17 -11
- data/lib/sequel/adapters/swift.rb +3 -3
- data/lib/sequel/adapters/swift/mysql.rb +1 -1
- data/lib/sequel/adapters/swift/sqlite.rb +1 -1
- data/lib/sequel/adapters/tinytds.rb +8 -8
- data/lib/sequel/ast_transformer.rb +3 -1
- data/lib/sequel/connection_pool.rb +4 -2
- data/lib/sequel/connection_pool/sharded_single.rb +2 -2
- data/lib/sequel/connection_pool/sharded_threaded.rb +5 -5
- data/lib/sequel/connection_pool/threaded.rb +7 -7
- data/lib/sequel/core.rb +4 -67
- data/lib/sequel/database.rb +1 -0
- data/lib/sequel/database/connecting.rb +2 -8
- data/lib/sequel/database/dataset.rb +2 -7
- data/lib/sequel/database/dataset_defaults.rb +0 -18
- data/lib/sequel/database/features.rb +4 -4
- data/lib/sequel/database/misc.rb +6 -8
- data/lib/sequel/database/query.rb +5 -61
- data/lib/sequel/database/schema_generator.rb +22 -20
- data/lib/sequel/database/schema_methods.rb +48 -20
- data/lib/sequel/database/transactions.rb +7 -17
- data/lib/sequel/dataset.rb +2 -0
- data/lib/sequel/dataset/actions.rb +23 -91
- data/lib/sequel/dataset/features.rb +1 -4
- data/lib/sequel/dataset/graph.rb +3 -47
- data/lib/sequel/dataset/misc.rb +4 -33
- data/lib/sequel/dataset/prepared_statements.rb +3 -1
- data/lib/sequel/dataset/query.rb +116 -240
- data/lib/sequel/dataset/sql.rb +19 -97
- data/lib/sequel/deprecated.rb +0 -16
- data/lib/sequel/exceptions.rb +0 -3
- data/lib/sequel/extensions/_pretty_table.rb +1 -1
- data/lib/sequel/extensions/columns_introspection.rb +1 -12
- data/lib/sequel/extensions/constraint_validations.rb +3 -3
- data/lib/sequel/extensions/core_extensions.rb +0 -9
- data/lib/sequel/extensions/date_arithmetic.rb +1 -2
- data/lib/sequel/extensions/graph_each.rb +11 -0
- data/lib/sequel/extensions/migration.rb +5 -5
- data/lib/sequel/extensions/null_dataset.rb +11 -13
- data/lib/sequel/extensions/pagination.rb +3 -6
- data/lib/sequel/extensions/pg_array.rb +6 -4
- data/lib/sequel/extensions/pg_array_ops.rb +35 -1
- data/lib/sequel/extensions/pg_json.rb +12 -2
- data/lib/sequel/extensions/pg_json_ops.rb +266 -0
- data/lib/sequel/extensions/pg_range.rb +2 -2
- data/lib/sequel/extensions/pg_range_ops.rb +0 -8
- data/lib/sequel/extensions/pg_row.rb +2 -2
- data/lib/sequel/extensions/pretty_table.rb +0 -4
- data/lib/sequel/extensions/query.rb +3 -8
- data/lib/sequel/extensions/schema_caching.rb +0 -7
- data/lib/sequel/extensions/schema_dumper.rb +10 -17
- data/lib/sequel/extensions/select_remove.rb +0 -4
- data/lib/sequel/extensions/set_overrides.rb +28 -0
- data/lib/sequel/extensions/to_dot.rb +6 -10
- data/lib/sequel/model.rb +6 -7
- data/lib/sequel/model/associations.rb +127 -182
- data/lib/sequel/model/base.rb +88 -211
- data/lib/sequel/model/errors.rb +0 -13
- data/lib/sequel/model/plugins.rb +2 -2
- data/lib/sequel/no_core_ext.rb +0 -1
- data/lib/sequel/plugins/after_initialize.rb +11 -17
- data/lib/sequel/plugins/association_autoreloading.rb +1 -47
- data/lib/sequel/plugins/association_dependencies.rb +2 -2
- data/lib/sequel/plugins/auto_validations.rb +2 -8
- data/lib/sequel/plugins/blacklist_security.rb +32 -2
- data/lib/sequel/plugins/caching.rb +1 -1
- data/lib/sequel/plugins/class_table_inheritance.rb +2 -2
- data/lib/sequel/plugins/composition.rb +10 -8
- data/lib/sequel/plugins/constraint_validations.rb +2 -2
- data/lib/sequel/plugins/dataset_associations.rb +4 -0
- data/lib/sequel/plugins/defaults_setter.rb +8 -6
- data/lib/sequel/plugins/dirty.rb +6 -6
- data/lib/sequel/plugins/force_encoding.rb +13 -8
- data/lib/sequel/plugins/hook_class_methods.rb +1 -7
- data/lib/sequel/plugins/json_serializer.rb +13 -74
- data/lib/sequel/plugins/lazy_attributes.rb +2 -4
- data/lib/sequel/plugins/list.rb +1 -1
- data/lib/sequel/plugins/many_through_many.rb +4 -11
- data/lib/sequel/plugins/many_to_one_pk_lookup.rb +1 -49
- data/lib/sequel/plugins/nested_attributes.rb +1 -1
- data/lib/sequel/plugins/optimistic_locking.rb +3 -5
- data/lib/sequel/plugins/pg_array_associations.rb +453 -0
- data/lib/sequel/plugins/pg_typecast_on_load.rb +23 -7
- data/lib/sequel/plugins/prepared_statements.rb +1 -1
- data/lib/sequel/plugins/prepared_statements_associations.rb +20 -14
- data/lib/sequel/plugins/prepared_statements_safe.rb +2 -2
- data/lib/sequel/plugins/rcte_tree.rb +1 -1
- data/lib/sequel/plugins/serialization.rb +5 -4
- data/lib/sequel/plugins/serialization_modification_detection.rb +1 -1
- data/lib/sequel/plugins/sharding.rb +7 -1
- data/lib/sequel/plugins/single_table_inheritance.rb +1 -1
- data/lib/sequel/plugins/timestamps.rb +1 -1
- data/lib/sequel/plugins/touch.rb +2 -2
- data/lib/sequel/plugins/tree.rb +1 -1
- data/lib/sequel/plugins/typecast_on_load.rb +19 -4
- data/lib/sequel/plugins/validation_class_methods.rb +0 -30
- data/lib/sequel/plugins/validation_helpers.rb +13 -31
- data/lib/sequel/plugins/xml_serializer.rb +18 -57
- data/lib/sequel/sql.rb +20 -22
- data/lib/sequel/version.rb +2 -2
- data/spec/adapters/db2_spec.rb +14 -23
- data/spec/adapters/firebird_spec.rb +25 -29
- data/spec/adapters/informix_spec.rb +11 -14
- data/spec/adapters/mssql_spec.rb +71 -77
- data/spec/adapters/mysql_spec.rb +165 -172
- data/spec/adapters/oracle_spec.rb +36 -39
- data/spec/adapters/postgres_spec.rb +175 -100
- data/spec/adapters/spec_helper.rb +13 -11
- data/spec/adapters/sqlite_spec.rb +36 -44
- data/spec/core/connection_pool_spec.rb +2 -1
- data/spec/core/database_spec.rb +55 -55
- data/spec/core/dataset_spec.rb +45 -249
- data/spec/core/deprecated_spec.rb +0 -8
- data/spec/core/expression_filters_spec.rb +23 -5
- data/spec/core/object_graph_spec.rb +4 -66
- data/spec/core/schema_spec.rb +35 -12
- data/spec/core/spec_helper.rb +3 -2
- data/spec/core_extensions_spec.rb +17 -19
- data/spec/extensions/arbitrary_servers_spec.rb +2 -3
- data/spec/extensions/association_dependencies_spec.rb +14 -14
- data/spec/extensions/auto_validations_spec.rb +7 -0
- data/spec/extensions/blacklist_security_spec.rb +5 -5
- data/spec/extensions/blank_spec.rb +2 -0
- data/spec/extensions/class_table_inheritance_spec.rb +2 -2
- data/spec/extensions/columns_introspection_spec.rb +2 -29
- data/spec/extensions/composition_spec.rb +10 -17
- data/spec/extensions/core_refinements_spec.rb +5 -1
- data/spec/extensions/dataset_associations_spec.rb +18 -0
- data/spec/extensions/date_arithmetic_spec.rb +2 -2
- data/spec/extensions/defaults_setter_spec.rb +9 -9
- data/spec/extensions/dirty_spec.rb +0 -5
- data/spec/extensions/eval_inspect_spec.rb +2 -0
- data/spec/extensions/force_encoding_spec.rb +2 -18
- data/spec/extensions/hash_aliases_spec.rb +8 -0
- data/spec/extensions/hook_class_methods_spec.rb +39 -58
- data/spec/extensions/inflector_spec.rb +2 -0
- data/spec/extensions/instance_filters_spec.rb +8 -8
- data/spec/extensions/json_serializer_spec.rb +1 -41
- data/spec/extensions/list_spec.rb +1 -1
- data/spec/extensions/many_through_many_spec.rb +106 -109
- data/spec/extensions/migration_spec.rb +2 -0
- data/spec/extensions/named_timezones_spec.rb +1 -0
- data/spec/extensions/pg_array_associations_spec.rb +603 -0
- data/spec/extensions/pg_array_ops_spec.rb +25 -0
- data/spec/extensions/pg_array_spec.rb +9 -1
- data/spec/extensions/pg_hstore_ops_spec.rb +13 -0
- data/spec/extensions/pg_hstore_spec.rb +1 -0
- data/spec/extensions/pg_json_ops_spec.rb +131 -0
- data/spec/extensions/pg_json_spec.rb +10 -4
- data/spec/extensions/pg_range_ops_spec.rb +2 -5
- data/spec/extensions/pg_range_spec.rb +6 -2
- data/spec/extensions/pg_row_ops_spec.rb +2 -0
- data/spec/extensions/prepared_statements_associations_spec.rb +26 -5
- data/spec/extensions/rcte_tree_spec.rb +15 -15
- data/spec/extensions/schema_dumper_spec.rb +0 -1
- data/spec/extensions/schema_spec.rb +9 -9
- data/spec/extensions/serialization_modification_detection_spec.rb +1 -1
- data/spec/extensions/serialization_spec.rb +18 -29
- data/spec/extensions/set_overrides_spec.rb +4 -0
- data/spec/extensions/{many_to_one_pk_lookup_spec.rb → shared_caching_spec.rb} +1 -4
- data/spec/extensions/single_table_inheritance_spec.rb +4 -4
- data/spec/extensions/spec_helper.rb +8 -9
- data/spec/extensions/sql_expr_spec.rb +2 -0
- data/spec/extensions/string_date_time_spec.rb +2 -0
- data/spec/extensions/string_stripper_spec.rb +2 -0
- data/spec/extensions/tactical_eager_loading_spec.rb +12 -12
- data/spec/extensions/thread_local_timezones_spec.rb +2 -0
- data/spec/extensions/timestamps_spec.rb +1 -1
- data/spec/extensions/to_dot_spec.rb +1 -1
- data/spec/extensions/touch_spec.rb +24 -24
- data/spec/extensions/tree_spec.rb +7 -7
- data/spec/extensions/typecast_on_load_spec.rb +8 -1
- data/spec/extensions/update_primary_key_spec.rb +10 -10
- data/spec/extensions/validation_class_methods_spec.rb +10 -39
- data/spec/extensions/validation_helpers_spec.rb +29 -47
- data/spec/extensions/xml_serializer_spec.rb +1 -23
- data/spec/integration/associations_test.rb +231 -40
- data/spec/integration/database_test.rb +1 -1
- data/spec/integration/dataset_test.rb +64 -64
- data/spec/integration/eager_loader_test.rb +28 -28
- data/spec/integration/migrator_test.rb +1 -1
- data/spec/integration/model_test.rb +2 -2
- data/spec/integration/plugin_test.rb +21 -21
- data/spec/integration/prepared_statement_test.rb +7 -7
- data/spec/integration/schema_test.rb +115 -110
- data/spec/integration/spec_helper.rb +17 -27
- data/spec/integration/timezone_test.rb +1 -1
- data/spec/integration/transaction_test.rb +10 -10
- data/spec/integration/type_test.rb +2 -2
- data/spec/model/association_reflection_spec.rb +2 -28
- data/spec/model/associations_spec.rb +239 -188
- data/spec/model/base_spec.rb +27 -68
- data/spec/model/dataset_methods_spec.rb +4 -4
- data/spec/model/eager_loading_spec.rb +160 -172
- data/spec/model/hooks_spec.rb +62 -79
- data/spec/model/model_spec.rb +36 -51
- data/spec/model/plugins_spec.rb +5 -19
- data/spec/model/record_spec.rb +125 -151
- data/spec/model/spec_helper.rb +8 -6
- data/spec/model/validations_spec.rb +4 -17
- data/spec/spec_config.rb +2 -10
- metadata +50 -56
- data/lib/sequel/deprecated_core_extensions.rb +0 -135
- data/lib/sequel/extensions/pg_auto_parameterize.rb +0 -185
- data/lib/sequel/extensions/pg_statement_cache.rb +0 -318
- data/lib/sequel/plugins/identity_map.rb +0 -260
- data/lib/sequel_core.rb +0 -2
- data/lib/sequel_model.rb +0 -2
- data/spec/extensions/association_autoreloading_spec.rb +0 -102
- data/spec/extensions/identity_map_spec.rb +0 -337
- data/spec/extensions/pg_auto_parameterize_spec.rb +0 -70
- data/spec/extensions/pg_statement_cache_spec.rb +0 -208
- data/spec/rcov.opts +0 -8
- data/spec/spec_config.rb.example +0 -10
|
@@ -2,7 +2,7 @@ require File.join(File.dirname(File.expand_path(__FILE__)), 'spec_helper.rb')
|
|
|
2
2
|
|
|
3
3
|
describe "Simple Dataset operations" do
|
|
4
4
|
before do
|
|
5
|
-
@db =
|
|
5
|
+
@db = DB
|
|
6
6
|
@db.create_table!(:items) do
|
|
7
7
|
primary_key :id
|
|
8
8
|
Integer :number
|
|
@@ -232,7 +232,7 @@ end
|
|
|
232
232
|
|
|
233
233
|
describe "Simple dataset operations with nasty table names" do
|
|
234
234
|
before do
|
|
235
|
-
@db =
|
|
235
|
+
@db = DB
|
|
236
236
|
@table = :"i`t' [e]\"m\\s"
|
|
237
237
|
@qi = @db.quote_identifiers?
|
|
238
238
|
@db.quote_identifiers = true
|
|
@@ -259,14 +259,14 @@ end
|
|
|
259
259
|
|
|
260
260
|
describe Sequel::Dataset do
|
|
261
261
|
before do
|
|
262
|
-
|
|
262
|
+
DB.create_table!(:test) do
|
|
263
263
|
String :name
|
|
264
264
|
Integer :value
|
|
265
265
|
end
|
|
266
|
-
@d =
|
|
266
|
+
@d = DB[:test]
|
|
267
267
|
end
|
|
268
268
|
after do
|
|
269
|
-
|
|
269
|
+
DB.drop_table?(:test)
|
|
270
270
|
end
|
|
271
271
|
|
|
272
272
|
specify "should return the correct record count" do
|
|
@@ -349,49 +349,49 @@ describe Sequel::Database do
|
|
|
349
349
|
"\\'dingo",
|
|
350
350
|
"\\\\''dingo",
|
|
351
351
|
].each do |str|
|
|
352
|
-
|
|
352
|
+
DB.get(Sequel.cast(str, String)).should == str
|
|
353
353
|
str = "1#{str}1"
|
|
354
|
-
|
|
354
|
+
DB.get(Sequel.cast(str, String)).should == str
|
|
355
355
|
str = "#{str}#{str}"
|
|
356
|
-
|
|
356
|
+
DB.get(Sequel.cast(str, String)).should == str
|
|
357
357
|
end
|
|
358
358
|
end
|
|
359
359
|
|
|
360
360
|
cspecify "should properly escape binary data", [:odbc], [:jdbc, :hsqldb], :oracle do
|
|
361
|
-
|
|
361
|
+
DB.get(Sequel.cast(Sequel.blob("\1\2\3"), File).as(:a)).should == "\1\2\3"
|
|
362
362
|
end
|
|
363
363
|
|
|
364
364
|
cspecify "should properly escape identifiers", :db2, :oracle do
|
|
365
|
-
|
|
366
|
-
|
|
365
|
+
DB.create_table(:"\\'\"[]"){Integer :id}
|
|
366
|
+
DB.drop_table(:"\\'\"[]")
|
|
367
367
|
end
|
|
368
368
|
|
|
369
369
|
specify "should have a working table_exists?" do
|
|
370
370
|
t = :basdfdsafsaddsaf
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
371
|
+
DB.drop_table?(t)
|
|
372
|
+
DB.table_exists?(t).should == false
|
|
373
|
+
DB.create_table(t){Integer :a}
|
|
374
374
|
begin
|
|
375
|
-
|
|
375
|
+
DB.table_exists?(t).should == true
|
|
376
376
|
ensure
|
|
377
|
-
|
|
377
|
+
DB.drop_table(t)
|
|
378
378
|
end
|
|
379
379
|
end
|
|
380
380
|
end
|
|
381
381
|
|
|
382
382
|
describe Sequel::Dataset do
|
|
383
383
|
before do
|
|
384
|
-
|
|
384
|
+
DB.create_table! :items do
|
|
385
385
|
primary_key :id
|
|
386
386
|
Integer :value
|
|
387
387
|
end
|
|
388
|
-
@d =
|
|
388
|
+
@d = DB[:items]
|
|
389
389
|
@d << {:value => 123}
|
|
390
390
|
@d << {:value => 456}
|
|
391
391
|
@d << {:value => 789}
|
|
392
392
|
end
|
|
393
393
|
after do
|
|
394
|
-
|
|
394
|
+
DB.drop_table?(:items)
|
|
395
395
|
end
|
|
396
396
|
|
|
397
397
|
specify "should correctly return avg" do
|
|
@@ -413,14 +413,14 @@ end
|
|
|
413
413
|
|
|
414
414
|
describe "Simple Dataset operations" do
|
|
415
415
|
before do
|
|
416
|
-
|
|
416
|
+
DB.create_table!(:items) do
|
|
417
417
|
Integer :number
|
|
418
418
|
TrueClass :flag
|
|
419
419
|
end
|
|
420
|
-
@ds =
|
|
420
|
+
@ds = DB[:items]
|
|
421
421
|
end
|
|
422
422
|
after do
|
|
423
|
-
|
|
423
|
+
DB.drop_table?(:items)
|
|
424
424
|
end
|
|
425
425
|
|
|
426
426
|
specify "should deal with boolean conditions correctly" do
|
|
@@ -439,18 +439,18 @@ end
|
|
|
439
439
|
|
|
440
440
|
describe "Simple Dataset operations in transactions" do
|
|
441
441
|
before do
|
|
442
|
-
|
|
442
|
+
DB.create_table!(:items) do
|
|
443
443
|
primary_key :id
|
|
444
444
|
integer :number
|
|
445
445
|
end
|
|
446
|
-
@ds =
|
|
446
|
+
@ds = DB[:items]
|
|
447
447
|
end
|
|
448
448
|
after do
|
|
449
|
-
|
|
449
|
+
DB.drop_table?(:items)
|
|
450
450
|
end
|
|
451
451
|
|
|
452
452
|
cspecify "should insert correctly with a primary key specified inside a transaction", :db2, :mssql do
|
|
453
|
-
|
|
453
|
+
DB.transaction do
|
|
454
454
|
@ds.insert(:id=>100, :number=>20)
|
|
455
455
|
@ds.count.should == 1
|
|
456
456
|
@ds.order(:id).all.should == [{:id=>100, :number=>20}]
|
|
@@ -458,7 +458,7 @@ describe "Simple Dataset operations in transactions" do
|
|
|
458
458
|
end
|
|
459
459
|
|
|
460
460
|
specify "should have insert return primary key value inside a transaction" do
|
|
461
|
-
|
|
461
|
+
DB.transaction do
|
|
462
462
|
@ds.insert(:number=>20).should == 1
|
|
463
463
|
@ds.count.should == 1
|
|
464
464
|
@ds.order(:id).all.should == [{:id=>1, :number=>20}]
|
|
@@ -466,23 +466,23 @@ describe "Simple Dataset operations in transactions" do
|
|
|
466
466
|
end
|
|
467
467
|
|
|
468
468
|
specify "should support for_update" do
|
|
469
|
-
|
|
469
|
+
DB.transaction{@ds.for_update.all.should == []}
|
|
470
470
|
end
|
|
471
471
|
end
|
|
472
472
|
|
|
473
473
|
describe "Dataset UNION, EXCEPT, and INTERSECT" do
|
|
474
474
|
before do
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
@ds1 =
|
|
475
|
+
DB.create_table!(:i1){integer :number}
|
|
476
|
+
DB.create_table!(:i2){integer :number}
|
|
477
|
+
@ds1 = DB[:i1]
|
|
478
478
|
@ds1.insert(:number=>10)
|
|
479
479
|
@ds1.insert(:number=>20)
|
|
480
|
-
@ds2 =
|
|
480
|
+
@ds2 = DB[:i2]
|
|
481
481
|
@ds2.insert(:number=>10)
|
|
482
482
|
@ds2.insert(:number=>30)
|
|
483
483
|
end
|
|
484
484
|
after do
|
|
485
|
-
|
|
485
|
+
DB.drop_table?(:i1, :i2, :i3)
|
|
486
486
|
end
|
|
487
487
|
|
|
488
488
|
specify "should give the correct results for simple UNION, EXCEPT, and INTERSECT" do
|
|
@@ -516,8 +516,8 @@ describe "Dataset UNION, EXCEPT, and INTERSECT" do
|
|
|
516
516
|
end
|
|
517
517
|
|
|
518
518
|
specify "should give the correct results for compound UNION, EXCEPT, and INTERSECT" do
|
|
519
|
-
|
|
520
|
-
@ds3 =
|
|
519
|
+
DB.create_table!(:i3){integer :number}
|
|
520
|
+
@ds3 = DB[:i3]
|
|
521
521
|
@ds3.insert(:number=>10)
|
|
522
522
|
@ds3.insert(:number=>40)
|
|
523
523
|
|
|
@@ -546,10 +546,10 @@ describe "Dataset UNION, EXCEPT, and INTERSECT" do
|
|
|
546
546
|
end
|
|
547
547
|
end
|
|
548
548
|
|
|
549
|
-
if
|
|
549
|
+
if DB.dataset.supports_cte?
|
|
550
550
|
describe "Common Table Expressions" do
|
|
551
551
|
before(:all) do
|
|
552
|
-
@db =
|
|
552
|
+
@db = DB
|
|
553
553
|
@db.create_table!(:i1){Integer :id; Integer :parent_id}
|
|
554
554
|
@ds = @db[:i1]
|
|
555
555
|
@ds.insert(:id=>1)
|
|
@@ -601,10 +601,10 @@ if INTEGRATION_DB.dataset.supports_cte?
|
|
|
601
601
|
end
|
|
602
602
|
end
|
|
603
603
|
|
|
604
|
-
if
|
|
604
|
+
if DB.dataset.supports_cte?(:update) # Assume INSERT and DELETE support as well
|
|
605
605
|
describe "Common Table Expressions in INSERT/UPDATE/DELETE" do
|
|
606
606
|
before do
|
|
607
|
-
@db =
|
|
607
|
+
@db = DB
|
|
608
608
|
@db.create_table!(:i1){Integer :id}
|
|
609
609
|
@ds = @db[:i1]
|
|
610
610
|
@ds2 = @ds.with(:t, @ds)
|
|
@@ -626,10 +626,10 @@ if INTEGRATION_DB.dataset.supports_cte?(:update) # Assume INSERT and DELETE supp
|
|
|
626
626
|
end
|
|
627
627
|
end
|
|
628
628
|
|
|
629
|
-
if
|
|
629
|
+
if DB.dataset.supports_returning?(:insert)
|
|
630
630
|
describe "RETURNING clauses in INSERT" do
|
|
631
631
|
before do
|
|
632
|
-
@db =
|
|
632
|
+
@db = DB
|
|
633
633
|
@db.create_table!(:i1){Integer :id; Integer :foo}
|
|
634
634
|
@ds = @db[:i1]
|
|
635
635
|
end
|
|
@@ -651,10 +651,10 @@ if INTEGRATION_DB.dataset.supports_returning?(:insert)
|
|
|
651
651
|
end
|
|
652
652
|
end
|
|
653
653
|
|
|
654
|
-
if
|
|
654
|
+
if DB.dataset.supports_returning?(:update) # Assume DELETE support as well
|
|
655
655
|
describe "RETURNING clauses in UPDATE/DELETE" do
|
|
656
656
|
before do
|
|
657
|
-
@db =
|
|
657
|
+
@db = DB
|
|
658
658
|
@db.create_table!(:i1){Integer :id; Integer :foo}
|
|
659
659
|
@ds = @db[:i1]
|
|
660
660
|
@ds.insert(1, 2)
|
|
@@ -687,10 +687,10 @@ if INTEGRATION_DB.dataset.supports_returning?(:update) # Assume DELETE support a
|
|
|
687
687
|
end
|
|
688
688
|
end
|
|
689
689
|
|
|
690
|
-
if
|
|
690
|
+
if DB.dataset.supports_window_functions?
|
|
691
691
|
describe "Window Functions" do
|
|
692
692
|
before(:all) do
|
|
693
|
-
@db =
|
|
693
|
+
@db = DB
|
|
694
694
|
@db.create_table!(:i1){Integer :id; Integer :group_id; Integer :amount}
|
|
695
695
|
@ds = @db[:i1].order(:id)
|
|
696
696
|
@ds.insert(:id=>1, :group_id=>1, :amount=>1)
|
|
@@ -741,7 +741,7 @@ end
|
|
|
741
741
|
|
|
742
742
|
describe Sequel::SQL::Constants do
|
|
743
743
|
before do
|
|
744
|
-
@db =
|
|
744
|
+
@db = DB
|
|
745
745
|
@ds = @db[:constants]
|
|
746
746
|
@c = proc do |v|
|
|
747
747
|
case v
|
|
@@ -788,7 +788,7 @@ end
|
|
|
788
788
|
|
|
789
789
|
describe "Sequel::Dataset#import and #multi_insert" do
|
|
790
790
|
before(:all) do
|
|
791
|
-
@db =
|
|
791
|
+
@db = DB
|
|
792
792
|
@db.create_table!(:imp){Integer :i}
|
|
793
793
|
@ids = @db[:imp].order(:i)
|
|
794
794
|
end
|
|
@@ -831,7 +831,7 @@ end
|
|
|
831
831
|
|
|
832
832
|
describe "Sequel::Dataset#import and #multi_insert :return=>:primary_key " do
|
|
833
833
|
before do
|
|
834
|
-
@db =
|
|
834
|
+
@db = DB
|
|
835
835
|
@db.create_table!(:imp){primary_key :id; Integer :i}
|
|
836
836
|
@ds = @db[:imp]
|
|
837
837
|
end
|
|
@@ -854,7 +854,7 @@ end
|
|
|
854
854
|
|
|
855
855
|
describe "Sequel::Dataset convenience methods" do
|
|
856
856
|
before(:all) do
|
|
857
|
-
@db =
|
|
857
|
+
@db = DB
|
|
858
858
|
@db.create_table!(:a){Integer :a; Integer :b; Integer :c}
|
|
859
859
|
@ds = @db[:a]
|
|
860
860
|
@ds.insert(1, 3, 5)
|
|
@@ -870,17 +870,17 @@ describe "Sequel::Dataset convenience methods" do
|
|
|
870
870
|
it "#group_rollup should include hierarchy of groupings" do
|
|
871
871
|
@ds.group_by(:a).group_rollup.select_map([:a, Sequel.function(:sum, :b).cast(Integer).as(:b), Sequel.function(:sum, :c).cast(Integer).as(:c)]).sort_by{|x| x.inspect}.should == [[1, 10, 16], [2, 7, 11], [nil, 17, 27]]
|
|
872
872
|
@ds.group_by(:a, :b).group_rollup.select_map([:a, :b, Sequel.function(:sum, :c).cast(Integer).as(:c)]).sort_by{|x| x.inspect}.should == [[1, 3, 11], [1, 4, 5], [1, nil, 16], [2, 3, 5], [2, 4, 6], [2, nil, 11], [nil, nil, 27]]
|
|
873
|
-
end if
|
|
873
|
+
end if DB.dataset.supports_group_rollup?
|
|
874
874
|
|
|
875
875
|
it "#group_cube should include all combinations of groupings" do
|
|
876
876
|
@ds.group_by(:a).group_cube.select_map([:a, Sequel.function(:sum, :b).cast(Integer).as(:b), Sequel.function(:sum, :c).cast(Integer).as(:c)]).sort_by{|x| x.inspect}.should == [[1, 10, 16], [2, 7, 11], [nil, 17, 27]]
|
|
877
877
|
@ds.group_by(:a, :b).group_cube.select_map([:a, :b, Sequel.function(:sum, :c).cast(Integer).as(:c)]).sort_by{|x| x.inspect}.should == [[1, 3, 11], [1, 4, 5], [1, nil, 16], [2, 3, 5], [2, 4, 6], [2, nil, 11], [nil, 3, 16], [nil, 4, 11], [nil, nil, 27]]
|
|
878
|
-
end if
|
|
878
|
+
end if DB.dataset.supports_group_cube?
|
|
879
879
|
end
|
|
880
880
|
|
|
881
881
|
describe "Sequel::Dataset convenience methods" do
|
|
882
882
|
before(:all) do
|
|
883
|
-
@db =
|
|
883
|
+
@db = DB
|
|
884
884
|
@db.create_table!(:a){Integer :a; Integer :b}
|
|
885
885
|
@ds = @db[:a].order(:a)
|
|
886
886
|
end
|
|
@@ -958,7 +958,7 @@ end
|
|
|
958
958
|
|
|
959
959
|
describe "Sequel::Dataset main SQL methods" do
|
|
960
960
|
before(:all) do
|
|
961
|
-
@db =
|
|
961
|
+
@db = DB
|
|
962
962
|
@db.create_table!(:d){Integer :a; Integer :b}
|
|
963
963
|
@ds = @db[:d].order(:a)
|
|
964
964
|
end
|
|
@@ -1029,7 +1029,7 @@ end
|
|
|
1029
1029
|
|
|
1030
1030
|
describe "Sequel::Dataset convenience methods" do
|
|
1031
1031
|
before(:all) do
|
|
1032
|
-
@db =
|
|
1032
|
+
@db = DB
|
|
1033
1033
|
@db.create_table!(:a){Integer :a; Integer :b; Integer :c; Integer :d}
|
|
1034
1034
|
@ds = @db[:a].order(:a)
|
|
1035
1035
|
end
|
|
@@ -1131,7 +1131,7 @@ end
|
|
|
1131
1131
|
|
|
1132
1132
|
describe "Sequel::Dataset DSL support" do
|
|
1133
1133
|
before(:all) do
|
|
1134
|
-
@db =
|
|
1134
|
+
@db = DB
|
|
1135
1135
|
@db.create_table!(:a){Integer :a; Integer :b}
|
|
1136
1136
|
@ds = @db[:a].order(:a)
|
|
1137
1137
|
end
|
|
@@ -1365,7 +1365,7 @@ end
|
|
|
1365
1365
|
|
|
1366
1366
|
describe "SQL Extract Function" do
|
|
1367
1367
|
before do
|
|
1368
|
-
@db =
|
|
1368
|
+
@db = DB
|
|
1369
1369
|
@db.create_table!(:a){DateTime :a}
|
|
1370
1370
|
@ds = @db[:a].order(:a)
|
|
1371
1371
|
end
|
|
@@ -1388,7 +1388,7 @@ end
|
|
|
1388
1388
|
|
|
1389
1389
|
describe "Dataset string methods" do
|
|
1390
1390
|
before(:all) do
|
|
1391
|
-
@db =
|
|
1391
|
+
@db = DB
|
|
1392
1392
|
csc = {}
|
|
1393
1393
|
cic = {}
|
|
1394
1394
|
csc[:collate] = @db.dataset_class::CASE_SENSITIVE_COLLATION if defined? @db.dataset_class::CASE_SENSITIVE_COLLATION
|
|
@@ -1493,7 +1493,7 @@ describe "Dataset string methods" do
|
|
|
1493
1493
|
@ds.filter(Sequel.expr(:b).ilike("#{@ds.escape_like('Bar%')}%")).select_order_map(:b).should == ['bar%', 'bar%.', 'bar%..']
|
|
1494
1494
|
end
|
|
1495
1495
|
|
|
1496
|
-
if
|
|
1496
|
+
if DB.dataset.supports_regexp?
|
|
1497
1497
|
it "#like with regexp return matching rows" do
|
|
1498
1498
|
@ds.insert('foo', 'bar')
|
|
1499
1499
|
@ds.filter(Sequel.expr(:a).like(/fo/)).all.should == [{:a=>'foo', :b=>'bar'}]
|
|
@@ -1546,7 +1546,7 @@ describe "Dataset identifier methods" do
|
|
|
1546
1546
|
upcase.reverse
|
|
1547
1547
|
end
|
|
1548
1548
|
end
|
|
1549
|
-
@db =
|
|
1549
|
+
@db = DB
|
|
1550
1550
|
@db.create_table!(:a){Integer :ab}
|
|
1551
1551
|
@db[:a].insert(1)
|
|
1552
1552
|
end
|
|
@@ -1577,7 +1577,7 @@ end
|
|
|
1577
1577
|
|
|
1578
1578
|
describe "Dataset defaults and overrides" do
|
|
1579
1579
|
before(:all) do
|
|
1580
|
-
@db =
|
|
1580
|
+
@db = DB
|
|
1581
1581
|
@db.create_table!(:a){Integer :a}
|
|
1582
1582
|
@ds = @db[:a].order(:a).extension(:set_overrides)
|
|
1583
1583
|
end
|
|
@@ -1603,14 +1603,14 @@ describe "Dataset defaults and overrides" do
|
|
|
1603
1603
|
end
|
|
1604
1604
|
end
|
|
1605
1605
|
|
|
1606
|
-
if
|
|
1606
|
+
if DB.dataset.supports_modifying_joins?
|
|
1607
1607
|
describe "Modifying joined datasets" do
|
|
1608
1608
|
before do
|
|
1609
|
-
@db =
|
|
1609
|
+
@db = DB
|
|
1610
1610
|
@db.create_table!(:a){Integer :a; Integer :d}
|
|
1611
1611
|
@db.create_table!(:b){Integer :b; Integer :e}
|
|
1612
1612
|
@db.create_table!(:c){Integer :c; Integer :f}
|
|
1613
|
-
@ds = @db.from(:a, :b).join(:c, :c=>Sequel.identifier(:e)).where(:d=>:b, :f=>6)
|
|
1613
|
+
@ds = @db.from(:a, :b).join(:c, {:c=>Sequel.identifier(:e)}, :qualify=>:symbol).where(:d=>:b, :f=>6)
|
|
1614
1614
|
@db[:a].insert(1, 2)
|
|
1615
1615
|
@db[:a].insert(3, 4)
|
|
1616
1616
|
@db[:b].insert(2, 5)
|
|
@@ -1642,7 +1642,7 @@ end
|
|
|
1642
1642
|
|
|
1643
1643
|
describe "Emulated functions" do
|
|
1644
1644
|
before(:all) do
|
|
1645
|
-
@db =
|
|
1645
|
+
@db = DB
|
|
1646
1646
|
@db.create_table!(:a){String :a}
|
|
1647
1647
|
@ds = @db[:a]
|
|
1648
1648
|
end
|
|
@@ -2,8 +2,8 @@ require File.join(File.dirname(File.expand_path(__FILE__)), 'spec_helper.rb')
|
|
|
2
2
|
|
|
3
3
|
describe "Eagerly loading a tree structure" do
|
|
4
4
|
before(:all) do
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
DB.instance_variable_set(:@schemas, {})
|
|
6
|
+
DB.create_table!(:nodes) do
|
|
7
7
|
primary_key :id
|
|
8
8
|
foreign_key :parent_id, :nodes
|
|
9
9
|
end
|
|
@@ -68,7 +68,7 @@ describe "Eagerly loading a tree structure" do
|
|
|
68
68
|
Node.insert(:parent_id=>6)
|
|
69
69
|
end
|
|
70
70
|
after(:all) do
|
|
71
|
-
|
|
71
|
+
DB.drop_table :nodes
|
|
72
72
|
Object.send(:remove_const, :Node)
|
|
73
73
|
end
|
|
74
74
|
|
|
@@ -128,14 +128,14 @@ describe "Association Extensions" do
|
|
|
128
128
|
first(:name=>name) || model.create(:name=>name, :author_id=>model_object.pk)
|
|
129
129
|
end
|
|
130
130
|
end
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
DB.instance_variable_set(:@schemas, {})
|
|
132
|
+
DB.create_table!(:authors) do
|
|
133
133
|
primary_key :id
|
|
134
134
|
end
|
|
135
135
|
class ::Author < Sequel::Model
|
|
136
136
|
one_to_many :authorships, :extend=>FindOrCreate
|
|
137
137
|
end
|
|
138
|
-
|
|
138
|
+
DB.create_table!(:authorships) do
|
|
139
139
|
primary_key :id
|
|
140
140
|
foreign_key :author_id, :authors
|
|
141
141
|
String :name
|
|
@@ -146,7 +146,7 @@ describe "Association Extensions" do
|
|
|
146
146
|
@author = Author.create
|
|
147
147
|
end
|
|
148
148
|
after do
|
|
149
|
-
|
|
149
|
+
DB.drop_table :authorships, :authors
|
|
150
150
|
Object.send(:remove_const, :Author)
|
|
151
151
|
Object.send(:remove_const, :Authorship)
|
|
152
152
|
end
|
|
@@ -171,8 +171,8 @@ end
|
|
|
171
171
|
|
|
172
172
|
describe "has_many :through has_many and has_one :through belongs_to" do
|
|
173
173
|
before(:all) do
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
DB.instance_variable_set(:@schemas, {})
|
|
175
|
+
DB.create_table!(:firms) do
|
|
176
176
|
primary_key :id
|
|
177
177
|
end
|
|
178
178
|
class ::Firm < Sequel::Model
|
|
@@ -195,7 +195,7 @@ describe "has_many :through has_many and has_one :through belongs_to" do
|
|
|
195
195
|
end)
|
|
196
196
|
end
|
|
197
197
|
|
|
198
|
-
|
|
198
|
+
DB.create_table!(:clients) do
|
|
199
199
|
primary_key :id
|
|
200
200
|
foreign_key :firm_id, :firms
|
|
201
201
|
end
|
|
@@ -204,7 +204,7 @@ describe "has_many :through has_many and has_one :through belongs_to" do
|
|
|
204
204
|
one_to_many :invoices
|
|
205
205
|
end
|
|
206
206
|
|
|
207
|
-
|
|
207
|
+
DB.create_table!(:invoices) do
|
|
208
208
|
primary_key :id
|
|
209
209
|
foreign_key :client_id, :clients
|
|
210
210
|
end
|
|
@@ -251,7 +251,7 @@ describe "has_many :through has_many and has_one :through belongs_to" do
|
|
|
251
251
|
@invoice5 = Invoice.create(:client => @client3)
|
|
252
252
|
end
|
|
253
253
|
after(:all) do
|
|
254
|
-
|
|
254
|
+
DB.drop_table :invoices, :clients, :firms
|
|
255
255
|
Object.send(:remove_const, :Firm)
|
|
256
256
|
Object.send(:remove_const, :Client)
|
|
257
257
|
Object.send(:remove_const, :Invoice)
|
|
@@ -322,8 +322,8 @@ end
|
|
|
322
322
|
|
|
323
323
|
describe "Polymorphic Associations" do
|
|
324
324
|
before(:all) do
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
DB.instance_variable_set(:@schemas, {})
|
|
326
|
+
DB.create_table!(:assets) do
|
|
327
327
|
primary_key :id
|
|
328
328
|
Integer :attachable_id
|
|
329
329
|
String :attachable_type
|
|
@@ -356,7 +356,7 @@ describe "Polymorphic Associations" do
|
|
|
356
356
|
end)
|
|
357
357
|
end
|
|
358
358
|
|
|
359
|
-
|
|
359
|
+
DB.create_table!(:posts) do
|
|
360
360
|
primary_key :id
|
|
361
361
|
end
|
|
362
362
|
class ::Post < Sequel::Model
|
|
@@ -366,7 +366,7 @@ describe "Polymorphic Associations" do
|
|
|
366
366
|
:clearer=>proc{assets_dataset.update(:attachable_id=>nil, :attachable_type=>nil)}
|
|
367
367
|
end
|
|
368
368
|
|
|
369
|
-
|
|
369
|
+
DB.create_table!(:notes) do
|
|
370
370
|
primary_key :id
|
|
371
371
|
end
|
|
372
372
|
class ::Note < Sequel::Model
|
|
@@ -377,7 +377,7 @@ describe "Polymorphic Associations" do
|
|
|
377
377
|
end
|
|
378
378
|
end
|
|
379
379
|
before do
|
|
380
|
-
[:assets, :posts, :notes].each{|t|
|
|
380
|
+
[:assets, :posts, :notes].each{|t| DB[t].delete}
|
|
381
381
|
@post = Post.create
|
|
382
382
|
Note.create
|
|
383
383
|
@note = Note.create
|
|
@@ -387,7 +387,7 @@ describe "Polymorphic Associations" do
|
|
|
387
387
|
@asset2.associations.clear
|
|
388
388
|
end
|
|
389
389
|
after(:all) do
|
|
390
|
-
|
|
390
|
+
DB.drop_table :assets, :posts, :notes
|
|
391
391
|
Object.send(:remove_const, :Asset)
|
|
392
392
|
Object.send(:remove_const, :Post)
|
|
393
393
|
Object.send(:remove_const, :Note)
|
|
@@ -448,8 +448,8 @@ end
|
|
|
448
448
|
|
|
449
449
|
describe "many_to_one/one_to_many not referencing primary key" do
|
|
450
450
|
before(:all) do
|
|
451
|
-
|
|
452
|
-
|
|
451
|
+
DB.instance_variable_set(:@schemas, {})
|
|
452
|
+
DB.create_table!(:clients) do
|
|
453
453
|
primary_key :id
|
|
454
454
|
String :name
|
|
455
455
|
end
|
|
@@ -478,7 +478,7 @@ describe "many_to_one/one_to_many not referencing primary key" do
|
|
|
478
478
|
end)
|
|
479
479
|
end
|
|
480
480
|
|
|
481
|
-
|
|
481
|
+
DB.create_table!(:invoices) do
|
|
482
482
|
primary_key :id
|
|
483
483
|
String :client_name
|
|
484
484
|
end
|
|
@@ -504,7 +504,7 @@ describe "many_to_one/one_to_many not referencing primary key" do
|
|
|
504
504
|
@invoice2 = Invoice.create(:client_name=>'X')
|
|
505
505
|
end
|
|
506
506
|
after(:all) do
|
|
507
|
-
|
|
507
|
+
DB.drop_table :invoices, :clients
|
|
508
508
|
Object.send(:remove_const, :Client)
|
|
509
509
|
Object.send(:remove_const, :Invoice)
|
|
510
510
|
end
|
|
@@ -575,7 +575,7 @@ end
|
|
|
575
575
|
|
|
576
576
|
describe "statistics associations" do
|
|
577
577
|
before(:all) do
|
|
578
|
-
|
|
578
|
+
DB.create_table!(:projects) do
|
|
579
579
|
primary_key :id
|
|
580
580
|
String :name
|
|
581
581
|
end
|
|
@@ -599,7 +599,7 @@ describe "statistics associations" do
|
|
|
599
599
|
end
|
|
600
600
|
end
|
|
601
601
|
|
|
602
|
-
|
|
602
|
+
DB.create_table!(:tickets) do
|
|
603
603
|
primary_key :id
|
|
604
604
|
foreign_key :project_id, :projects
|
|
605
605
|
Integer :hours
|
|
@@ -616,7 +616,7 @@ describe "statistics associations" do
|
|
|
616
616
|
@ticket4 = Ticket.create(:project=>@project2, :hours=>20)
|
|
617
617
|
end
|
|
618
618
|
after(:all) do
|
|
619
|
-
|
|
619
|
+
DB.drop_table :tickets, :projects
|
|
620
620
|
Object.send(:remove_const, :Project)
|
|
621
621
|
Object.send(:remove_const, :Ticket)
|
|
622
622
|
end
|
|
@@ -635,7 +635,7 @@ end
|
|
|
635
635
|
|
|
636
636
|
describe "one to one associations" do
|
|
637
637
|
before(:all) do
|
|
638
|
-
|
|
638
|
+
DB.create_table!(:books) do
|
|
639
639
|
primary_key :id
|
|
640
640
|
end
|
|
641
641
|
class ::Book < Sequel::Model
|
|
@@ -643,7 +643,7 @@ describe "one to one associations" do
|
|
|
643
643
|
one_to_one :second_page, :class=>:Page, :conditions=>{:page_number=>2}, :reciprocal=>nil
|
|
644
644
|
end
|
|
645
645
|
|
|
646
|
-
|
|
646
|
+
DB.create_table!(:pages) do
|
|
647
647
|
primary_key :id
|
|
648
648
|
foreign_key :book_id, :books
|
|
649
649
|
Integer :page_number
|
|
@@ -660,7 +660,7 @@ describe "one to one associations" do
|
|
|
660
660
|
@page4 = Page.create(:book=>@book2, :page_number=>2)
|
|
661
661
|
end
|
|
662
662
|
after(:all) do
|
|
663
|
-
|
|
663
|
+
DB.drop_table :pages, :books
|
|
664
664
|
Object.send(:remove_const, :Book)
|
|
665
665
|
Object.send(:remove_const, :Page)
|
|
666
666
|
end
|