sequel 4.41.0 → 4.42.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 +98 -0
- data/README.rdoc +23 -10
- data/doc/active_record.rdoc +4 -4
- data/doc/advanced_associations.rdoc +2 -2
- data/doc/association_basics.rdoc +5 -2
- data/doc/cheat_sheet.rdoc +3 -3
- data/doc/core_extensions.rdoc +2 -2
- data/doc/dataset_basics.rdoc +4 -4
- data/doc/dataset_filtering.rdoc +1 -1
- data/doc/migration.rdoc +19 -1
- data/doc/prepared_statements.rdoc +2 -2
- data/doc/release_notes/4.42.0.txt +221 -0
- data/doc/testing.rdoc +3 -1
- data/lib/sequel/adapters/ado/access.rb +0 -1
- data/lib/sequel/adapters/ado/mssql.rb +0 -1
- data/lib/sequel/adapters/do/mysql.rb +0 -1
- data/lib/sequel/adapters/do/postgres.rb +0 -1
- data/lib/sequel/adapters/do/sqlite3.rb +0 -1
- data/lib/sequel/adapters/ibmdb.rb +21 -25
- data/lib/sequel/adapters/jdbc.rb +8 -16
- data/lib/sequel/adapters/jdbc/as400.rb +0 -1
- data/lib/sequel/adapters/jdbc/cubrid.rb +0 -1
- data/lib/sequel/adapters/jdbc/db2.rb +0 -1
- data/lib/sequel/adapters/jdbc/derby.rb +0 -1
- data/lib/sequel/adapters/jdbc/firebirdsql.rb +0 -1
- data/lib/sequel/adapters/jdbc/h2.rb +0 -1
- data/lib/sequel/adapters/jdbc/hsqldb.rb +0 -1
- data/lib/sequel/adapters/jdbc/informix-sqli.rb +0 -1
- data/lib/sequel/adapters/jdbc/jdbcprogress.rb +0 -1
- data/lib/sequel/adapters/jdbc/jtds.rb +0 -1
- data/lib/sequel/adapters/jdbc/mssql.rb +0 -1
- data/lib/sequel/adapters/jdbc/mysql.rb +0 -1
- data/lib/sequel/adapters/jdbc/oracle.rb +0 -1
- data/lib/sequel/adapters/jdbc/postgresql.rb +0 -13
- data/lib/sequel/adapters/jdbc/sqlanywhere.rb +0 -1
- data/lib/sequel/adapters/jdbc/sqlite.rb +0 -1
- data/lib/sequel/adapters/jdbc/sqlserver.rb +3 -4
- data/lib/sequel/adapters/mock.rb +54 -12
- data/lib/sequel/adapters/mysql.rb +1 -1
- data/lib/sequel/adapters/mysql2.rb +11 -17
- data/lib/sequel/adapters/odbc/mssql.rb +0 -1
- data/lib/sequel/adapters/oracle.rb +8 -20
- data/lib/sequel/adapters/postgres.rb +11 -29
- data/lib/sequel/adapters/shared/access.rb +5 -12
- data/lib/sequel/adapters/shared/cubrid.rb +4 -13
- data/lib/sequel/adapters/shared/db2.rb +4 -2
- data/lib/sequel/adapters/shared/firebird.rb +2 -4
- data/lib/sequel/adapters/shared/informix.rb +4 -2
- data/lib/sequel/adapters/shared/mssql.rb +3 -5
- data/lib/sequel/adapters/shared/mysql.rb +4 -14
- data/lib/sequel/adapters/shared/oracle.rb +1 -3
- data/lib/sequel/adapters/shared/postgres.rb +16 -38
- data/lib/sequel/adapters/shared/progress.rb +0 -2
- data/lib/sequel/adapters/shared/sqlanywhere.rb +0 -2
- data/lib/sequel/adapters/shared/sqlite.rb +20 -16
- data/lib/sequel/adapters/sqlite.rb +8 -20
- data/lib/sequel/adapters/swift/mysql.rb +0 -1
- data/lib/sequel/adapters/swift/postgres.rb +0 -1
- data/lib/sequel/adapters/swift/sqlite.rb +0 -1
- data/lib/sequel/adapters/tinytds.rb +4 -12
- data/lib/sequel/adapters/utils/emulate_offset_with_reverse_and_count.rb +1 -1
- data/lib/sequel/adapters/utils/mysql_mysql2.rb +2 -2
- data/lib/sequel/adapters/utils/mysql_prepared_statements.rb +11 -34
- data/lib/sequel/adapters/utils/stored_procedures.rb +9 -22
- data/lib/sequel/adapters/utils/unmodified_identifiers.rb +26 -0
- data/lib/sequel/ast_transformer.rb +2 -2
- data/lib/sequel/database/dataset.rb +1 -1
- data/lib/sequel/database/dataset_defaults.rb +0 -66
- data/lib/sequel/database/features.rb +6 -0
- data/lib/sequel/database/misc.rb +31 -17
- data/lib/sequel/database/query.rb +7 -4
- data/lib/sequel/database/schema_methods.rb +1 -1
- data/lib/sequel/dataset.rb +8 -8
- data/lib/sequel/dataset/actions.rb +140 -46
- data/lib/sequel/dataset/features.rb +1 -5
- data/lib/sequel/dataset/graph.rb +7 -8
- data/lib/sequel/dataset/misc.rb +127 -56
- data/lib/sequel/dataset/mutation.rb +9 -20
- data/lib/sequel/dataset/placeholder_literalizer.rb +10 -1
- data/lib/sequel/dataset/prepared_statements.rb +102 -46
- data/lib/sequel/dataset/query.rb +155 -72
- data/lib/sequel/dataset/sql.rb +26 -9
- data/lib/sequel/extensions/columns_introspection.rb +3 -1
- data/lib/sequel/extensions/core_extensions.rb +5 -5
- data/lib/sequel/extensions/core_refinements.rb +5 -5
- data/lib/sequel/extensions/duplicate_columns_handler.rb +4 -2
- data/lib/sequel/extensions/freeze_datasets.rb +69 -0
- data/lib/sequel/extensions/identifier_mangling.rb +196 -0
- data/lib/sequel/extensions/looser_typecasting.rb +11 -7
- data/lib/sequel/extensions/migration.rb +1 -1
- data/lib/sequel/extensions/null_dataset.rb +5 -2
- data/lib/sequel/extensions/pagination.rb +42 -23
- data/lib/sequel/extensions/pg_enum.rb +3 -3
- data/lib/sequel/extensions/query.rb +3 -3
- data/lib/sequel/extensions/sequel_3_dataset_methods.rb +15 -8
- data/lib/sequel/model/associations.rb +25 -8
- data/lib/sequel/model/base.rb +88 -29
- data/lib/sequel/model/dataset_module.rb +37 -0
- data/lib/sequel/plugins/association_pks.rb +4 -4
- data/lib/sequel/plugins/class_table_inheritance.rb +2 -2
- data/lib/sequel/plugins/constraint_validations.rb +1 -2
- data/lib/sequel/plugins/csv_serializer.rb +2 -2
- data/lib/sequel/plugins/dataset_associations.rb +8 -8
- data/lib/sequel/plugins/eager_each.rb +2 -2
- data/lib/sequel/plugins/instance_filters.rb +1 -1
- data/lib/sequel/plugins/json_serializer.rb +2 -2
- data/lib/sequel/plugins/lazy_attributes.rb +1 -1
- data/lib/sequel/plugins/list.rb +4 -4
- data/lib/sequel/plugins/prepared_statements.rb +2 -4
- data/lib/sequel/plugins/prepared_statements_associations.rb +1 -3
- data/lib/sequel/plugins/prepared_statements_with_pk.rb +1 -1
- data/lib/sequel/plugins/rcte_tree.rb +13 -13
- data/lib/sequel/plugins/sharding.rb +1 -1
- data/lib/sequel/plugins/single_table_inheritance.rb +9 -4
- data/lib/sequel/plugins/tactical_eager_loading.rb +4 -4
- data/lib/sequel/plugins/validation_class_methods.rb +1 -1
- data/lib/sequel/plugins/validation_helpers.rb +1 -1
- data/lib/sequel/plugins/xml_serializer.rb +2 -2
- data/lib/sequel/sql.rb +69 -36
- data/lib/sequel/version.rb +1 -1
- data/spec/adapters/db2_spec.rb +10 -0
- data/spec/adapters/firebird_spec.rb +1 -1
- data/spec/adapters/mssql_spec.rb +4 -5
- data/spec/adapters/mysql_spec.rb +9 -9
- data/spec/adapters/postgres_spec.rb +67 -68
- data/spec/adapters/spec_helper.rb +6 -1
- data/spec/adapters/sqlite_spec.rb +29 -15
- data/spec/core/connection_pool_spec.rb +14 -14
- data/spec/core/database_spec.rb +38 -180
- data/spec/core/dataset_mutation_spec.rb +253 -0
- data/spec/core/dataset_spec.rb +394 -537
- data/spec/core/expression_filters_spec.rb +34 -32
- data/spec/core/mock_adapter_spec.rb +27 -35
- data/spec/core/placeholder_literalizer_spec.rb +2 -4
- data/spec/core/schema_generator_spec.rb +4 -4
- data/spec/core/schema_spec.rb +1 -2
- data/spec/core_extensions_spec.rb +22 -29
- data/spec/extensions/active_model_spec.rb +6 -6
- data/spec/extensions/association_dependencies_spec.rb +2 -2
- data/spec/extensions/blacklist_security_spec.rb +3 -3
- data/spec/extensions/boolean_readers_spec.rb +12 -12
- data/spec/extensions/caching_spec.rb +13 -10
- data/spec/extensions/class_table_inheritance_spec.rb +38 -43
- data/spec/extensions/column_conflicts_spec.rb +1 -3
- data/spec/extensions/columns_introspection_spec.rb +2 -3
- data/spec/extensions/composition_spec.rb +5 -3
- data/spec/extensions/constraint_validations_plugin_spec.rb +5 -5
- data/spec/extensions/constraint_validations_spec.rb +14 -8
- data/spec/extensions/core_refinements_spec.rb +22 -29
- data/spec/extensions/csv_serializer_spec.rb +7 -6
- data/spec/extensions/date_arithmetic_spec.rb +15 -15
- data/spec/extensions/defaults_setter_spec.rb +2 -2
- data/spec/extensions/delay_add_association_spec.rb +1 -1
- data/spec/extensions/dirty_spec.rb +19 -10
- data/spec/extensions/duplicate_columns_handler_spec.rb +12 -18
- data/spec/extensions/eager_each_spec.rb +12 -16
- data/spec/extensions/empty_array_consider_nulls_spec.rb +1 -1
- data/spec/extensions/eval_inspect_spec.rb +4 -3
- data/spec/extensions/force_encoding_spec.rb +12 -12
- data/spec/extensions/freeze_datasets_spec.rb +31 -0
- data/spec/extensions/graph_each_spec.rb +6 -18
- data/spec/extensions/hook_class_methods_spec.rb +7 -7
- data/spec/extensions/identifier_mangling_spec.rb +307 -0
- data/spec/extensions/instance_filters_spec.rb +5 -6
- data/spec/extensions/instance_hooks_spec.rb +12 -12
- data/spec/extensions/json_serializer_spec.rb +12 -15
- data/spec/extensions/lazy_attributes_spec.rb +4 -4
- data/spec/extensions/list_spec.rb +19 -21
- data/spec/extensions/many_through_many_spec.rb +108 -163
- data/spec/extensions/meta_def_spec.rb +7 -2
- data/spec/extensions/migration_spec.rb +10 -12
- data/spec/extensions/mssql_optimistic_locking_spec.rb +4 -3
- data/spec/extensions/named_timezones_spec.rb +4 -3
- data/spec/extensions/nested_attributes_spec.rb +2 -2
- data/spec/extensions/null_dataset_spec.rb +17 -12
- data/spec/extensions/optimistic_locking_spec.rb +4 -5
- data/spec/extensions/pagination_spec.rb +8 -10
- data/spec/extensions/pg_array_associations_spec.rb +28 -27
- data/spec/extensions/pg_array_ops_spec.rb +2 -1
- data/spec/extensions/pg_array_spec.rb +6 -2
- data/spec/extensions/pg_enum_spec.rb +5 -3
- data/spec/extensions/pg_hstore_ops_spec.rb +3 -1
- data/spec/extensions/pg_hstore_spec.rb +7 -6
- data/spec/extensions/pg_inet_ops_spec.rb +2 -1
- data/spec/extensions/pg_inet_spec.rb +2 -1
- data/spec/extensions/pg_interval_spec.rb +2 -1
- data/spec/extensions/pg_json_ops_spec.rb +2 -1
- data/spec/extensions/pg_json_spec.rb +6 -3
- data/spec/extensions/pg_loose_count_spec.rb +1 -0
- data/spec/extensions/pg_range_ops_spec.rb +3 -1
- data/spec/extensions/pg_range_spec.rb +9 -5
- data/spec/extensions/pg_row_ops_spec.rb +2 -1
- data/spec/extensions/pg_row_plugin_spec.rb +4 -6
- data/spec/extensions/pg_row_spec.rb +5 -3
- data/spec/extensions/pg_static_cache_updater_spec.rb +2 -1
- data/spec/extensions/pg_typecast_on_load_spec.rb +1 -1
- data/spec/extensions/prepared_statements_associations_spec.rb +1 -1
- data/spec/extensions/prepared_statements_spec.rb +12 -11
- data/spec/extensions/pretty_table_spec.rb +1 -1
- data/spec/extensions/query_spec.rb +8 -5
- data/spec/extensions/rcte_tree_spec.rb +39 -39
- data/spec/extensions/round_timestamps_spec.rb +2 -2
- data/spec/extensions/schema_dumper_spec.rb +3 -2
- data/spec/extensions/schema_spec.rb +2 -2
- data/spec/extensions/scissors_spec.rb +1 -2
- data/spec/extensions/sequel_3_dataset_methods_spec.rb +30 -17
- data/spec/extensions/serialization_modification_detection_spec.rb +2 -2
- data/spec/extensions/serialization_spec.rb +15 -13
- data/spec/extensions/set_overrides_spec.rb +14 -8
- data/spec/extensions/sharding_spec.rb +9 -18
- data/spec/extensions/shared_caching_spec.rb +3 -4
- data/spec/extensions/single_table_inheritance_spec.rb +11 -11
- data/spec/extensions/skip_create_refresh_spec.rb +2 -1
- data/spec/extensions/spec_helper.rb +1 -1
- data/spec/extensions/split_values_spec.rb +2 -2
- data/spec/extensions/sql_comments_spec.rb +6 -0
- data/spec/extensions/static_cache_spec.rb +7 -9
- data/spec/extensions/string_agg_spec.rb +30 -29
- data/spec/extensions/tactical_eager_loading_spec.rb +4 -5
- data/spec/extensions/thread_local_timezones_spec.rb +2 -2
- data/spec/extensions/timestamps_spec.rb +28 -3
- data/spec/extensions/to_dot_spec.rb +1 -2
- data/spec/extensions/tree_spec.rb +33 -29
- data/spec/extensions/typecast_on_load_spec.rb +1 -1
- data/spec/extensions/unlimited_update_spec.rb +1 -0
- data/spec/extensions/update_primary_key_spec.rb +11 -7
- data/spec/extensions/update_refresh_spec.rb +1 -1
- data/spec/extensions/uuid_spec.rb +0 -1
- data/spec/extensions/validate_associated_spec.rb +1 -1
- data/spec/extensions/validation_class_methods_spec.rb +10 -10
- data/spec/extensions/validation_helpers_spec.rb +10 -10
- data/spec/extensions/xml_serializer_spec.rb +7 -3
- data/spec/integration/associations_test.rb +31 -31
- data/spec/integration/dataset_test.rb +17 -19
- data/spec/integration/eager_loader_test.rb +24 -24
- data/spec/integration/model_test.rb +6 -6
- data/spec/integration/plugin_test.rb +43 -43
- data/spec/integration/prepared_statement_test.rb +6 -6
- data/spec/integration/schema_test.rb +63 -52
- data/spec/integration/spec_helper.rb +6 -1
- data/spec/integration/transaction_test.rb +13 -13
- data/spec/model/association_reflection_spec.rb +17 -17
- data/spec/model/associations_spec.rb +101 -96
- data/spec/model/base_spec.rb +175 -49
- data/spec/model/class_dataset_methods_spec.rb +5 -9
- data/spec/model/dataset_methods_spec.rb +5 -5
- data/spec/model/eager_loading_spec.rb +209 -235
- data/spec/model/hooks_spec.rb +15 -15
- data/spec/model/model_spec.rb +28 -21
- data/spec/model/plugins_spec.rb +4 -5
- data/spec/model/record_spec.rb +59 -57
- data/spec/model/spec_helper.rb +1 -1
- data/spec/model/validations_spec.rb +6 -6
- data/spec/spec_config.rb +1 -1
- metadata +10 -2
|
@@ -357,11 +357,6 @@ describe "Simple dataset operations with nasty table names" do
|
|
|
357
357
|
before do
|
|
358
358
|
@db = DB
|
|
359
359
|
@table = :"i`t' [e]\"m\\s"
|
|
360
|
-
@qi = @db.quote_identifiers?
|
|
361
|
-
@db.quote_identifiers = true
|
|
362
|
-
end
|
|
363
|
-
after do
|
|
364
|
-
@db.quote_identifiers = @qi
|
|
365
360
|
end
|
|
366
361
|
|
|
367
362
|
cspecify "should work correctly", :oracle, :sqlanywhere, [:jdbc, :mssql] do
|
|
@@ -378,7 +373,7 @@ describe "Simple dataset operations with nasty table names" do
|
|
|
378
373
|
@ds.count.must_equal 0
|
|
379
374
|
@db.drop_table?(@table)
|
|
380
375
|
end
|
|
381
|
-
end
|
|
376
|
+
end if DB.dataset.quote_identifiers?
|
|
382
377
|
|
|
383
378
|
describe Sequel::Dataset do
|
|
384
379
|
before do
|
|
@@ -396,8 +391,12 @@ describe Sequel::Dataset do
|
|
|
396
391
|
@d.count.must_equal 0
|
|
397
392
|
@d << {:name => 'abc', :value => 123}
|
|
398
393
|
@d << {:name => 'abc', :value => 456}
|
|
399
|
-
@d << {:name => 'def', :value =>
|
|
400
|
-
|
|
394
|
+
@d << {:name => 'def', :value => nil}
|
|
395
|
+
5.times do
|
|
396
|
+
@d.count.must_equal 3
|
|
397
|
+
@d.count(:name).must_equal 3
|
|
398
|
+
@d.count(:value).must_equal 2
|
|
399
|
+
end
|
|
401
400
|
end
|
|
402
401
|
|
|
403
402
|
it "should handle functions with identifier names correctly" do
|
|
@@ -455,7 +454,7 @@ describe Sequel::Dataset do
|
|
|
455
454
|
@d << {:name => 'abc', :value => 456}
|
|
456
455
|
@d << {:name => 'def', :value => 789}
|
|
457
456
|
@d.count.must_equal 3
|
|
458
|
-
@d.truncate.
|
|
457
|
+
@d.truncate.must_be_nil
|
|
459
458
|
@d.count.must_equal 0
|
|
460
459
|
end
|
|
461
460
|
|
|
@@ -1435,7 +1434,6 @@ describe "Sequel::Dataset DSL support" do
|
|
|
1435
1434
|
|
|
1436
1435
|
it "should work with multiple value arrays" do
|
|
1437
1436
|
@ds.insert(20, 10)
|
|
1438
|
-
@ds = @ds.with_quote_identifiers(false)
|
|
1439
1437
|
@ds.filter([:a, :b]=>[[20, 10]]).all.must_equal [{:a=>20, :b=>10}]
|
|
1440
1438
|
@ds.filter([:a, :b]=>[[10, 20]]).all.must_equal []
|
|
1441
1439
|
@ds.filter([:a, :b]=>[[20, 10], [1, 2]]).all.must_equal [{:a=>20, :b=>10}]
|
|
@@ -1449,7 +1447,7 @@ describe "Sequel::Dataset DSL support" do
|
|
|
1449
1447
|
|
|
1450
1448
|
it "should work with IN/NOT in with datasets" do
|
|
1451
1449
|
@ds.insert(20, 10)
|
|
1452
|
-
ds = @ds.unordered
|
|
1450
|
+
ds = @ds.unordered
|
|
1453
1451
|
|
|
1454
1452
|
@ds.filter(:a=>ds.select(:a)).all.must_equal [{:a=>20, :b=>10}]
|
|
1455
1453
|
@ds.filter(:a=>ds.select(:a).where(:a=>15)).all.must_equal []
|
|
@@ -1484,10 +1482,10 @@ describe "Sequel::Dataset DSL support" do
|
|
|
1484
1482
|
unless Sequel.guarded?(:mssql, :oracle, :db2, :sqlanywhere)
|
|
1485
1483
|
# Some databases don't like boolean results in the select list
|
|
1486
1484
|
pr = proc{|r| r.is_a?(Integer) ? (r != 0) : r}
|
|
1487
|
-
pr[@ds.get(Sequel.expr(:a=>[]))].
|
|
1488
|
-
pr[@ds.get(~Sequel.expr(:a=>[]))].
|
|
1489
|
-
pr[@ds.get(Sequel.expr([:a, :b]=>[]))].
|
|
1490
|
-
pr[@ds.get(~Sequel.expr([:a, :b]=>[]))].
|
|
1485
|
+
pr[@ds.get(Sequel.expr(:a=>[]))].must_be_nil
|
|
1486
|
+
pr[@ds.get(~Sequel.expr(:a=>[]))].must_be_nil
|
|
1487
|
+
pr[@ds.get(Sequel.expr([:a, :b]=>[]))].must_be_nil
|
|
1488
|
+
pr[@ds.get(~Sequel.expr([:a, :b]=>[]))].must_be_nil
|
|
1491
1489
|
end
|
|
1492
1490
|
end
|
|
1493
1491
|
|
|
@@ -1531,7 +1529,7 @@ describe "SQL Extract Function" do
|
|
|
1531
1529
|
|
|
1532
1530
|
it "should return the part of the datetime asked for" do
|
|
1533
1531
|
t = Time.now
|
|
1534
|
-
@ds = @ds.with_extend
|
|
1532
|
+
@ds = @ds.with_extend{def supports_timestamp_timezones?() false end}
|
|
1535
1533
|
@ds.insert(t)
|
|
1536
1534
|
@ds.get{a.extract(:year)}.must_equal t.year
|
|
1537
1535
|
@ds.get{a.extract(:month)}.must_equal t.month
|
|
@@ -1725,7 +1723,7 @@ describe "Dataset identifier methods" do
|
|
|
1725
1723
|
it "should work when not quoting identifiers" do
|
|
1726
1724
|
@ds.with_quote_identifiers(false).first.must_equal(:ab=>1)
|
|
1727
1725
|
end
|
|
1728
|
-
end
|
|
1726
|
+
end if IDENTIFIER_MANGLING
|
|
1729
1727
|
|
|
1730
1728
|
describe "Dataset defaults and overrides" do
|
|
1731
1729
|
before(:all) do
|
|
@@ -1806,7 +1804,7 @@ describe "Emulated functions" do
|
|
|
1806
1804
|
end
|
|
1807
1805
|
|
|
1808
1806
|
it "Sequel.char_length should return the length of characters in the string" do
|
|
1809
|
-
@ds.get(Sequel.char_length(:a)).
|
|
1807
|
+
@ds.get(Sequel.char_length(:a)).must_be_nil
|
|
1810
1808
|
@ds.insert(:a=>'foo')
|
|
1811
1809
|
@ds.get(Sequel.char_length(:a)).must_equal 3
|
|
1812
1810
|
# Check behavior with leading/trailing blanks
|
|
@@ -1815,7 +1813,7 @@ describe "Emulated functions" do
|
|
|
1815
1813
|
end
|
|
1816
1814
|
|
|
1817
1815
|
it "Sequel.trim should return the string with spaces trimmed from both sides" do
|
|
1818
|
-
@ds.get(Sequel.trim(:a)).
|
|
1816
|
+
@ds.get(Sequel.trim(:a)).must_be_nil
|
|
1819
1817
|
@ds.insert(:a=>'foo')
|
|
1820
1818
|
@ds.get(Sequel.trim(:a)).must_equal 'foo'
|
|
1821
1819
|
# Check behavior with leading/trailing blanks
|
|
@@ -103,7 +103,7 @@ describe "Eagerly loading a tree structure" do
|
|
|
103
103
|
nodes.length.must_equal 2
|
|
104
104
|
nodes.collect{|x| x.pk}.must_equal [3, 7]
|
|
105
105
|
nodes.first.parent.pk.must_equal 1
|
|
106
|
-
nodes.first.parent.parent.
|
|
106
|
+
nodes.first.parent.parent.must_be_nil
|
|
107
107
|
node = nodes.last
|
|
108
108
|
node.parent.pk.must_equal 6
|
|
109
109
|
node = node.parent
|
|
@@ -114,7 +114,7 @@ describe "Eagerly loading a tree structure" do
|
|
|
114
114
|
node.parent.pk.must_equal 2
|
|
115
115
|
node = node.parent
|
|
116
116
|
node.parent.pk.must_equal 1
|
|
117
|
-
node.parent.parent.
|
|
117
|
+
node.parent.parent.must_be_nil
|
|
118
118
|
end
|
|
119
119
|
end
|
|
120
120
|
|
|
@@ -291,7 +291,7 @@ describe "has_many :through has_many and has_one :through belongs_to" do
|
|
|
291
291
|
firm.must_equal @firm1
|
|
292
292
|
@invoice1.client.must_equal @client1
|
|
293
293
|
@invoice1.client.firm.must_equal @firm1
|
|
294
|
-
firm.associations[:clients].
|
|
294
|
+
firm.associations[:clients].must_be_nil
|
|
295
295
|
end
|
|
296
296
|
|
|
297
297
|
it "should eagerly load has_one :through belongs_to records for multiple objects" do
|
|
@@ -300,23 +300,23 @@ describe "has_many :through has_many and has_one :through belongs_to" do
|
|
|
300
300
|
invs[0].firm.must_equal @firm1
|
|
301
301
|
invs[0].client.must_equal @client1
|
|
302
302
|
invs[0].client.firm.must_equal @firm1
|
|
303
|
-
invs[0].firm.associations[:clients].
|
|
303
|
+
invs[0].firm.associations[:clients].must_be_nil
|
|
304
304
|
invs[1].firm.must_equal @firm1
|
|
305
305
|
invs[1].client.must_equal @client1
|
|
306
306
|
invs[1].client.firm.must_equal @firm1
|
|
307
|
-
invs[1].firm.associations[:clients].
|
|
307
|
+
invs[1].firm.associations[:clients].must_be_nil
|
|
308
308
|
invs[2].firm.must_equal @firm1
|
|
309
309
|
invs[2].client.must_equal @client2
|
|
310
310
|
invs[2].client.firm.must_equal @firm1
|
|
311
|
-
invs[2].firm.associations[:clients].
|
|
311
|
+
invs[2].firm.associations[:clients].must_be_nil
|
|
312
312
|
invs[3].firm.must_equal @firm2
|
|
313
313
|
invs[3].client.must_equal @client3
|
|
314
314
|
invs[3].client.firm.must_equal @firm2
|
|
315
|
-
invs[3].firm.associations[:clients].
|
|
315
|
+
invs[3].firm.associations[:clients].must_be_nil
|
|
316
316
|
invs[4].firm.must_equal @firm2
|
|
317
317
|
invs[4].client.must_equal @client3
|
|
318
318
|
invs[4].client.firm.must_equal @firm2
|
|
319
|
-
invs[4].firm.associations[:clients].
|
|
319
|
+
invs[4].firm.associations[:clients].must_be_nil
|
|
320
320
|
end
|
|
321
321
|
end
|
|
322
322
|
|
|
@@ -415,9 +415,9 @@ describe "Polymorphic Associations" do
|
|
|
415
415
|
@asset2.attachable_id.must_equal @post.pk
|
|
416
416
|
@asset2.attachable_type.must_equal 'Post'
|
|
417
417
|
@asset1.attachable = nil
|
|
418
|
-
@asset1.attachable.
|
|
419
|
-
@asset1.attachable_id.
|
|
420
|
-
@asset1.attachable_type.
|
|
418
|
+
@asset1.attachable.must_be_nil
|
|
419
|
+
@asset1.attachable_id.must_be_nil
|
|
420
|
+
@asset1.attachable_type.must_be_nil
|
|
421
421
|
end
|
|
422
422
|
|
|
423
423
|
it "should add items correctly" do
|
|
@@ -433,16 +433,16 @@ describe "Polymorphic Associations" do
|
|
|
433
433
|
@note.assets.must_equal [@asset2]
|
|
434
434
|
@note.remove_asset(@asset2)
|
|
435
435
|
@note.assets.must_equal []
|
|
436
|
-
@asset2.attachable.
|
|
437
|
-
@asset2.attachable_id.
|
|
438
|
-
@asset2.attachable_type.
|
|
436
|
+
@asset2.attachable.must_be_nil
|
|
437
|
+
@asset2.attachable_id.must_be_nil
|
|
438
|
+
@asset2.attachable_type.must_be_nil
|
|
439
439
|
end
|
|
440
440
|
|
|
441
441
|
it "should remove all items correctly" do
|
|
442
442
|
@post.remove_all_assets
|
|
443
443
|
@note.remove_all_assets
|
|
444
|
-
@asset1.reload.attachable.
|
|
445
|
-
@asset2.reload.attachable.
|
|
444
|
+
@asset1.reload.attachable.must_be_nil
|
|
445
|
+
@asset2.reload.attachable.must_be_nil
|
|
446
446
|
end
|
|
447
447
|
end
|
|
448
448
|
|
|
@@ -543,7 +543,7 @@ describe "many_to_one/one_to_many not referencing primary key" do
|
|
|
543
543
|
@invoice1.client.must_equal @client2
|
|
544
544
|
@invoice1.client_name.must_equal 'Y'
|
|
545
545
|
@invoice1.client = nil
|
|
546
|
-
@invoice1.client_name.
|
|
546
|
+
@invoice1.client_name.must_be_nil
|
|
547
547
|
end
|
|
548
548
|
|
|
549
549
|
it "should add the associated object correctly" do
|
|
@@ -552,7 +552,7 @@ describe "many_to_one/one_to_many not referencing primary key" do
|
|
|
552
552
|
@client2.invoices.must_equal [@invoice1]
|
|
553
553
|
@invoice1.client_name.must_equal 'Y'
|
|
554
554
|
@invoice1.client = nil
|
|
555
|
-
@invoice1.client_name.
|
|
555
|
+
@invoice1.client_name.must_be_nil
|
|
556
556
|
end
|
|
557
557
|
|
|
558
558
|
it "should remove the associated object correctly" do
|
|
@@ -560,16 +560,16 @@ describe "many_to_one/one_to_many not referencing primary key" do
|
|
|
560
560
|
invs.must_equal [@invoice1, @invoice2]
|
|
561
561
|
@client1.remove_invoice(@invoice1)
|
|
562
562
|
@client1.invoices.must_equal [@invoice2]
|
|
563
|
-
@invoice1.client_name.
|
|
564
|
-
@invoice1.client.
|
|
563
|
+
@invoice1.client_name.must_be_nil
|
|
564
|
+
@invoice1.client.must_be_nil
|
|
565
565
|
end
|
|
566
566
|
|
|
567
567
|
it "should remove all associated objects correctly" do
|
|
568
568
|
@client1.remove_all_invoices
|
|
569
|
-
@invoice1.refresh.client.
|
|
570
|
-
@invoice1.client_name.
|
|
571
|
-
@invoice2.refresh.client.
|
|
572
|
-
@invoice2.client_name.
|
|
569
|
+
@invoice1.refresh.client.must_be_nil
|
|
570
|
+
@invoice1.client_name.must_be_nil
|
|
571
|
+
@invoice2.refresh.client.must_be_nil
|
|
572
|
+
@invoice2.client_name.must_be_nil
|
|
573
573
|
end
|
|
574
574
|
end
|
|
575
575
|
|
|
@@ -17,7 +17,7 @@ describe "Sequel::Model basic support" do
|
|
|
17
17
|
|
|
18
18
|
it ".find should return first matching item" do
|
|
19
19
|
Item.all.must_equal []
|
|
20
|
-
Item.find(:name=>'J').
|
|
20
|
+
Item.find(:name=>'J').must_be_nil
|
|
21
21
|
Item.create(:name=>'J')
|
|
22
22
|
Item.find(:name=>'J').must_equal Item.load(:id=>1, :name=>'J')
|
|
23
23
|
end
|
|
@@ -25,7 +25,7 @@ describe "Sequel::Model basic support" do
|
|
|
25
25
|
it ".finder should create method that returns first matching item" do
|
|
26
26
|
def Item.by_name(name) where(:name=>name) end
|
|
27
27
|
Item.finder :by_name
|
|
28
|
-
Item.first_by_name('J').
|
|
28
|
+
Item.first_by_name('J').must_be_nil
|
|
29
29
|
Item.create(:name=>'J')
|
|
30
30
|
Item.first_by_name('J').must_equal Item.load(:id=>1, :name=>'J')
|
|
31
31
|
Item.first_by_name(['J', 'K']).must_equal Item.load(:id=>1, :name=>'J')
|
|
@@ -34,7 +34,7 @@ describe "Sequel::Model basic support" do
|
|
|
34
34
|
it ".prepared_finder should create method that returns first matching item" do
|
|
35
35
|
def Item.by_name(name) where(:name=>name) end
|
|
36
36
|
Item.prepared_finder :by_name
|
|
37
|
-
Item.first_by_name('J').
|
|
37
|
+
Item.first_by_name('J').must_be_nil
|
|
38
38
|
Item.create(:name=>'J')
|
|
39
39
|
Item.first_by_name('J').must_equal Item.load(:id=>1, :name=>'J')
|
|
40
40
|
end
|
|
@@ -83,7 +83,7 @@ describe "Sequel::Model basic support" do
|
|
|
83
83
|
def i.after_save
|
|
84
84
|
raise Sequel::Rollback
|
|
85
85
|
end
|
|
86
|
-
i.save.
|
|
86
|
+
i.save.must_be_nil
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
it "#should respect after_commit, after_rollback, after_destroy_commit, and after_destroy_rollback hooks" do
|
|
@@ -118,12 +118,12 @@ describe "Sequel::Model basic support" do
|
|
|
118
118
|
end
|
|
119
119
|
i.name = 'K'
|
|
120
120
|
i.rb = true
|
|
121
|
-
i.save.
|
|
121
|
+
i.save.must_be_nil
|
|
122
122
|
i.reload.name.must_equal 'J'
|
|
123
123
|
i.hooks.must_equal [:as, :ar]
|
|
124
124
|
|
|
125
125
|
i.rb = true
|
|
126
|
-
i.destroy.
|
|
126
|
+
i.destroy.must_be_nil
|
|
127
127
|
i.exists?.must_equal true
|
|
128
128
|
i.hooks.must_equal [:ad, :adr]
|
|
129
129
|
|
|
@@ -70,27 +70,27 @@ describe "Class Table Inheritance Plugin" do
|
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
it "should lazily load columns in subclass tables" do
|
|
73
|
-
Employee[@i2][:manager_id].
|
|
73
|
+
Employee[@i2][:manager_id].must_be_nil
|
|
74
74
|
Employee[@i2].manager_id.must_equal @i4
|
|
75
|
-
Employee[@i3][:num_staff].
|
|
75
|
+
Employee[@i3][:num_staff].must_be_nil
|
|
76
76
|
Employee[@i3].num_staff.must_equal 7
|
|
77
|
-
Employee[@i4][:num_staff].
|
|
77
|
+
Employee[@i4][:num_staff].must_be_nil
|
|
78
78
|
Employee[@i4].num_staff.must_equal 5
|
|
79
|
-
Employee[@i4][:num_managers].
|
|
79
|
+
Employee[@i4][:num_managers].must_be_nil
|
|
80
80
|
Employee[@i4].num_managers.must_equal 6
|
|
81
|
-
Employee[@i5][:num_managers].
|
|
81
|
+
Employee[@i5][:num_managers].must_be_nil
|
|
82
82
|
Employee[@i5].num_managers.must_equal 1
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
it "should eagerly load columns in subclass tables when retrieving multiple objects" do
|
|
86
86
|
a = Employee.order(:id).all
|
|
87
|
-
a[1][:manager_id].
|
|
87
|
+
a[1][:manager_id].must_be_nil
|
|
88
88
|
a[1].manager_id.must_equal @i4
|
|
89
|
-
a[2][:num_staff].
|
|
89
|
+
a[2][:num_staff].must_be_nil
|
|
90
90
|
a[2].num_staff.must_equal 7
|
|
91
91
|
a[3][:num_staff].must_equal 5 # eagerly loaded by previous call
|
|
92
92
|
a[3].num_staff.must_equal 5
|
|
93
|
-
a[3][:num_managers].
|
|
93
|
+
a[3][:num_managers].must_be_nil
|
|
94
94
|
a[3].num_managers.must_equal 6
|
|
95
95
|
a[4][:num_managers].must_equal 1
|
|
96
96
|
a[4].num_managers.must_equal 1
|
|
@@ -117,9 +117,9 @@ describe "Class Table Inheritance Plugin" do
|
|
|
117
117
|
i = e.id
|
|
118
118
|
e.staff_members_dataset.destroy
|
|
119
119
|
e.destroy
|
|
120
|
-
@db[:executives][:id=>i].
|
|
121
|
-
@db[:managers][:id=>i].
|
|
122
|
-
@db[:employees][:id=>i].
|
|
120
|
+
@db[:executives][:id=>i].must_be_nil
|
|
121
|
+
@db[:managers][:id=>i].must_be_nil
|
|
122
|
+
@db[:employees][:id=>i].must_be_nil
|
|
123
123
|
end
|
|
124
124
|
|
|
125
125
|
it "should handle associations only defined in subclasses" do
|
|
@@ -563,7 +563,7 @@ describe "Touch plugin" do
|
|
|
563
563
|
|
|
564
564
|
it "should update the timestamp column when touching the record" do
|
|
565
565
|
Album.plugin :touch
|
|
566
|
-
@album.updated_at.
|
|
566
|
+
@album.updated_at.must_be_nil
|
|
567
567
|
@album.touch
|
|
568
568
|
@album.updated_at.to_i.must_be_close_to Time.now.to_i, 2
|
|
569
569
|
end
|
|
@@ -571,7 +571,7 @@ describe "Touch plugin" do
|
|
|
571
571
|
cspecify "should update the timestamp column for many_to_one associated records when the record is updated or destroyed", [:do, :sqlite], [:jdbc, :sqlite], [:swift] do
|
|
572
572
|
Album.many_to_one :artist
|
|
573
573
|
Album.plugin :touch, :associations=>:artist
|
|
574
|
-
@artist.updated_at.
|
|
574
|
+
@artist.updated_at.must_be_nil
|
|
575
575
|
@album.update(:name=>'B')
|
|
576
576
|
ua = @artist.reload.updated_at
|
|
577
577
|
if ua.is_a?(Time)
|
|
@@ -591,7 +591,7 @@ describe "Touch plugin" do
|
|
|
591
591
|
cspecify "should update the timestamp column for one_to_many associated records when the record is updated", [:do, :sqlite], [:jdbc, :sqlite], [:swift] do
|
|
592
592
|
Artist.one_to_many :albums
|
|
593
593
|
Artist.plugin :touch, :associations=>:albums
|
|
594
|
-
@album.updated_at.
|
|
594
|
+
@album.updated_at.must_be_nil
|
|
595
595
|
@artist.update(:name=>'B')
|
|
596
596
|
ua = @album.reload.updated_at
|
|
597
597
|
if ua.is_a?(Time)
|
|
@@ -605,7 +605,7 @@ describe "Touch plugin" do
|
|
|
605
605
|
Artist.many_to_many :albums
|
|
606
606
|
Artist.plugin :touch, :associations=>:albums
|
|
607
607
|
@artist.add_album(@album)
|
|
608
|
-
@album.updated_at.
|
|
608
|
+
@album.updated_at.must_be_nil
|
|
609
609
|
@artist.update(:name=>'B')
|
|
610
610
|
ua = @album.reload.updated_at
|
|
611
611
|
if ua.is_a?(Time)
|
|
@@ -717,7 +717,7 @@ describe "Composition plugin" do
|
|
|
717
717
|
|
|
718
718
|
it "should return a composed object if the underlying columns have a value" do
|
|
719
719
|
@e1.date.must_equal Date.civil(2010, 2, 15)
|
|
720
|
-
@e2.date.
|
|
720
|
+
@e2.date.must_be_nil
|
|
721
721
|
end
|
|
722
722
|
|
|
723
723
|
it "should decompose the object when saving the record" do
|
|
@@ -755,8 +755,8 @@ describe "RcteTree Plugin" do
|
|
|
755
755
|
@aaab.children.must_equal []
|
|
756
756
|
@aaaaa.children.must_equal []
|
|
757
757
|
|
|
758
|
-
@a.parent.
|
|
759
|
-
@b.parent.
|
|
758
|
+
@a.parent.must_be_nil
|
|
759
|
+
@b.parent.must_be_nil
|
|
760
760
|
@aa.parent.must_equal @a
|
|
761
761
|
@ab.parent.must_equal @a
|
|
762
762
|
@ba.parent.must_equal @b
|
|
@@ -891,28 +891,28 @@ describe "RcteTree Plugin" do
|
|
|
891
891
|
|
|
892
892
|
it "should populate all :parent associations when eagerly loading ancestors for a dataset" do
|
|
893
893
|
nodes = @Node.filter(@Node.primary_key=>[@a.pk, @ba.pk, @aaa.pk, @aaaaa.pk]).order(:name).eager(:ancestors).all
|
|
894
|
-
nodes[0].associations.fetch(:parent, 1).
|
|
894
|
+
nodes[0].associations.fetch(:parent, 1).must_be_nil
|
|
895
895
|
nodes[1].associations[:parent].must_equal @aa
|
|
896
896
|
nodes[1].associations[:parent].associations[:parent].must_equal @a
|
|
897
|
-
nodes[1].associations[:parent].associations[:parent].associations.fetch(:parent, 1).
|
|
897
|
+
nodes[1].associations[:parent].associations[:parent].associations.fetch(:parent, 1).must_be_nil
|
|
898
898
|
nodes[2].associations[:parent].must_equal @aaaa
|
|
899
899
|
nodes[2].associations[:parent].associations[:parent].must_equal @aaa
|
|
900
900
|
nodes[2].associations[:parent].associations[:parent].associations[:parent].must_equal @aa
|
|
901
901
|
nodes[2].associations[:parent].associations[:parent].associations[:parent].associations[:parent].must_equal @a
|
|
902
|
-
nodes[2].associations[:parent].associations[:parent].associations[:parent].associations[:parent].associations.fetch(:parent, 1).
|
|
902
|
+
nodes[2].associations[:parent].associations[:parent].associations[:parent].associations[:parent].associations.fetch(:parent, 1).must_be_nil
|
|
903
903
|
nodes[3].associations[:parent].must_equal @b
|
|
904
|
-
nodes[3].associations[:parent].associations.fetch(:parent, 1).
|
|
904
|
+
nodes[3].associations[:parent].associations.fetch(:parent, 1).must_be_nil
|
|
905
905
|
end
|
|
906
906
|
|
|
907
907
|
it "should populate all :parent associations when lazily loading ancestors" do
|
|
908
908
|
@a.reload
|
|
909
909
|
@a.ancestors
|
|
910
|
-
@a.associations[:parent].
|
|
910
|
+
@a.associations[:parent].must_be_nil
|
|
911
911
|
|
|
912
912
|
@ba.reload
|
|
913
913
|
@ba.ancestors
|
|
914
914
|
@ba.associations[:parent].must_equal @b
|
|
915
|
-
@ba.associations[:parent].associations.fetch(:parent, 1).
|
|
915
|
+
@ba.associations[:parent].associations.fetch(:parent, 1).must_be_nil
|
|
916
916
|
|
|
917
917
|
@ba.reload
|
|
918
918
|
@aaaaa.ancestors
|
|
@@ -920,7 +920,7 @@ describe "RcteTree Plugin" do
|
|
|
920
920
|
@aaaaa.associations[:parent].associations[:parent].must_equal @aaa
|
|
921
921
|
@aaaaa.associations[:parent].associations[:parent].associations[:parent].must_equal @aa
|
|
922
922
|
@aaaaa.associations[:parent].associations[:parent].associations[:parent].associations[:parent].must_equal @a
|
|
923
|
-
@aaaaa.associations[:parent].associations[:parent].associations[:parent].associations[:parent].associations.fetch(:parent, 1).
|
|
923
|
+
@aaaaa.associations[:parent].associations[:parent].associations[:parent].associations[:parent].associations.fetch(:parent, 1).must_be_nil
|
|
924
924
|
end
|
|
925
925
|
end
|
|
926
926
|
|
|
@@ -1528,12 +1528,12 @@ describe "List plugin without a scope" do
|
|
|
1528
1528
|
|
|
1529
1529
|
it "should define prev and next" do
|
|
1530
1530
|
i = @c[:name => "abc"]
|
|
1531
|
-
i.prev.
|
|
1531
|
+
i.prev.must_be_nil
|
|
1532
1532
|
i = @c[:name => "def"]
|
|
1533
1533
|
i.prev.must_equal @c[:name => "abc"]
|
|
1534
1534
|
i.next.must_equal @c[:name => "hig"]
|
|
1535
1535
|
i = @c[:name => "hig"]
|
|
1536
|
-
i.next.
|
|
1536
|
+
i.next.must_be_nil
|
|
1537
1537
|
end
|
|
1538
1538
|
|
|
1539
1539
|
it "should define move_to" do
|
|
@@ -1623,10 +1623,10 @@ describe "List plugin with a scope" do
|
|
|
1623
1623
|
@c[:name => "P3"].prev(2).name.must_equal 'P1'
|
|
1624
1624
|
@c[:name => "P2"].prev(-1).name.must_equal 'P3'
|
|
1625
1625
|
|
|
1626
|
-
@c[:name => "Ps"].prev.
|
|
1627
|
-
@c[:name => "Au"].next.
|
|
1628
|
-
@c[:name => "P1"].prev.
|
|
1629
|
-
@c[:name => "P3"].next.
|
|
1626
|
+
@c[:name => "Ps"].prev.must_be_nil
|
|
1627
|
+
@c[:name => "Au"].next.must_be_nil
|
|
1628
|
+
@c[:name => "P1"].prev.must_be_nil
|
|
1629
|
+
@c[:name => "P3"].next.must_be_nil
|
|
1630
1630
|
end
|
|
1631
1631
|
|
|
1632
1632
|
it "should define move_to" do
|
|
@@ -1833,31 +1833,31 @@ describe "Sequel::Plugins::PreparedStatements" do
|
|
|
1833
1833
|
it "should work with looking up using Model.[]" do
|
|
1834
1834
|
@c[@foo.id].must_equal @foo
|
|
1835
1835
|
@c[@bar.id].must_equal @bar
|
|
1836
|
-
@c[0].
|
|
1837
|
-
@c[nil].
|
|
1836
|
+
@c[0].must_be_nil
|
|
1837
|
+
@c[nil].must_be_nil
|
|
1838
1838
|
end
|
|
1839
1839
|
|
|
1840
1840
|
it "should work with looking up using Dataset#with_pk" do
|
|
1841
1841
|
@c.dataset.with_pk(@foo.id).must_equal @foo
|
|
1842
1842
|
@c.dataset.with_pk(@bar.id).must_equal @bar
|
|
1843
|
-
@c.dataset.with_pk(0).
|
|
1844
|
-
@c.dataset.with_pk(nil).
|
|
1843
|
+
@c.dataset.with_pk(0).must_be_nil
|
|
1844
|
+
@c.dataset.with_pk(nil).must_be_nil
|
|
1845
1845
|
|
|
1846
|
-
@c.dataset.filter(:i=>0).with_pk(@foo.id).
|
|
1846
|
+
@c.dataset.filter(:i=>0).with_pk(@foo.id).must_be_nil
|
|
1847
1847
|
@c.dataset.filter(:i=>10).with_pk(@foo.id).must_equal @foo
|
|
1848
1848
|
@c.dataset.filter(:i=>20).with_pk(@bar.id).must_equal @bar
|
|
1849
|
-
@c.dataset.filter(:i=>10).with_pk(nil).
|
|
1849
|
+
@c.dataset.filter(:i=>10).with_pk(nil).must_be_nil
|
|
1850
1850
|
@c.dataset.filter(:name=>'foo').with_pk(@foo.id).must_equal @foo
|
|
1851
1851
|
@c.dataset.filter(:name=>'bar').with_pk(@bar.id).must_equal @bar
|
|
1852
|
-
@c.dataset.filter(:name=>'baz').with_pk(@bar.id).
|
|
1853
|
-
@c.dataset.filter(:name=>'bar').with_pk(nil).
|
|
1852
|
+
@c.dataset.filter(:name=>'baz').with_pk(@bar.id).must_be_nil
|
|
1853
|
+
@c.dataset.filter(:name=>'bar').with_pk(nil).must_be_nil
|
|
1854
1854
|
end
|
|
1855
1855
|
|
|
1856
1856
|
it "should work with Model#destroy" do
|
|
1857
1857
|
@foo.destroy
|
|
1858
1858
|
@bar.destroy
|
|
1859
|
-
@c[@foo.id].
|
|
1860
|
-
@c[@bar.id].
|
|
1859
|
+
@c[@foo.id].must_be_nil
|
|
1860
|
+
@c[@bar.id].must_be_nil
|
|
1861
1861
|
end
|
|
1862
1862
|
|
|
1863
1863
|
it "should work with Model#update" do
|
|
@@ -1952,8 +1952,8 @@ describe "Caching plugins" do
|
|
|
1952
1952
|
it "should work with looking up using Model.[]" do
|
|
1953
1953
|
@Artist[1].must_be_same_as(@Artist[1])
|
|
1954
1954
|
@Artist[:id=>1].must_equal @Artist[1]
|
|
1955
|
-
@Artist[0].
|
|
1956
|
-
@Artist[nil].
|
|
1955
|
+
@Artist[0].must_be_nil
|
|
1956
|
+
@Artist[nil].must_be_nil
|
|
1957
1957
|
end
|
|
1958
1958
|
|
|
1959
1959
|
it "should work with lookup up many_to_one associated objects" do
|