1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test/cases
Sean Griffin f0ddf87e4b Correct the behavior of virtual attributes on models loaded from the db
Previously we had primarily tested the behavior of these attributes by
calling `.new`, allowing this to slip through the cracks. There were a
few ways in which they were behaving incorrectly.

The biggest issue was that attempting to read the attribute would
through a `MissingAttribute` error. We've corrected this by returning
the default value when the attribute isn't backed by a database column.
This is super special cased, but I don't see a way to avoid this
conditional. I had considered handling this higher up in
`define_default_attribute`, but we don't have the relevant information
there as users can provide new defaults for database columns as well.

Once I corrected this, I had noticed that the attributes were always
being marked as changed. This is because the behavior of
`define_default_attribute` was treating them as assigned from
`Attribute::Null`.

Finally, with our new implementation, `LazyAttributeHash` could no
longer be marshalled, as it holds onto a proc. This has been corrected
as well. I've not handled YAML in that class, as we do additional work
higher up to avoid YAML dumping it at all.

Fixes #25787
Close #25841
2016-07-25 11:12:06 -04:00
..
adapters Fix explain logging with binds 2016-07-20 15:26:39 +09:00
associations adds missing requires 2016-07-24 21:29:29 +02:00
attribute_methods
coders Fix bug in JSON deserialization when column default is an empty string 2016-02-22 17:59:51 +01:00
connection_adapters Add to_hash to specification 2016-05-25 00:14:39 -04:00
connection_specification Remove name from establish_connection 2016-05-24 23:57:43 -04:00
fixture_set provide file name for fixture ERB 2016-03-30 12:32:39 +03:00
migration Oracle TIMESTAMP sql type is associated with Rails DateTime type now 2016-07-20 13:10:55 +00:00
relation No need public_send 2016-07-17 21:14:01 +09:00
scoping adds missing requires 2016-07-24 21:29:29 +02:00
tasks Merge pull request #23301 from ppworks/improve_mysqldump 2016-06-17 12:23:50 -04:00
type skipped assertion on datetime seconds precision as it is only valid for newer mysql versions 2015-09-24 00:35:50 +05:30
validations Add i18n_validation_test 2016-06-02 04:17:15 +00:00
adapter_test.rb remove_index do not fetch indexes if name is specified 2016-04-24 14:32:55 -07:00
aggregations_test.rb Ensure hashes can be passed to attributes using composed_of 2016-05-31 10:03:26 -04:00
ar_schema_test.rb Make to primary key instead of an unique index for internal tables 2016-01-31 03:26:57 +09:00
associations_test.rb
attribute_decorators_test.rb
attribute_methods_test.rb removes spurious line 2016-07-24 00:50:24 +02:00
attribute_set_test.rb Implement equality comparison on AttributeSet and friends 2015-10-06 08:52:28 -06:00
attribute_test.rb Fix failing tests 2016-06-02 11:06:01 -04:00
attributes_test.rb Correct the behavior of virtual attributes on models loaded from the db 2016-07-25 11:12:06 -04:00
autosave_association_test.rb Fixes funny spelling 2016-02-26 20:52:49 -06:00
base_test.rb Removed a forgotten with_exclusive_scope test: 2016-06-24 00:30:42 -04:00
batches_test.rb deprecates the error_on_ignored_order_or_limit instance reader 2016-07-18 10:45:54 +02:00
binary_test.rb Remove legacy mysql adapter 2015-12-17 15:54:57 +00:00
bind_parameter_test.rb Pass type_casted_binds to log subscriber for logging bind values properly 2016-07-19 14:11:58 +09:00
cache_key_test.rb fixes #21815 2015-10-16 15:09:45 +02:00
calculations_test.rb Fix Active Record test failure 2016-07-12 01:43:37 +09:00
callbacks_test.rb systematic revision of =~ usage in AR 2016-07-23 20:22:20 +02:00
clone_test.rb
collection_cache_key_test.rb Fix AR::Relation#cache_key to remove select scope added by user 2016-01-24 22:36:13 +05:30
column_alias_test.rb
column_definition_test.rb Remove unnecessary assert_valid_default 2016-06-25 21:17:27 +09:00
comment_test.rb Treat blank comments as no comment for indexes 2016-04-29 17:52:37 -07:00
connection_management_test.rb Do not attempt to return connection with open transaction to pool (#24610) 2016-04-22 12:56:43 -06:00
connection_pool_test.rb Fix payload[:class_name] to payload[:spec_name] 2016-07-17 22:04:06 +09:00
core_test.rb
counter_cache_test.rb remove args from assert_nothing_raised in tests 2016-02-22 22:56:23 -08:00
custom_locking_test.rb Remove legacy mysql adapter 2015-12-17 15:54:57 +00:00
database_statements_test.rb Deprecate {insert|update|delete}_sql in DatabaseStatements 2016-03-02 09:37:14 +09:00
date_test.rb Fix Type::Date#serialize to return a date object correctly 2016-06-16 08:04:16 +09:00
date_time_precision_test.rb Support microsecond datetime precision on MariaDB 5.3+. 2016-04-08 18:41:25 -07:00
date_time_test.rb
defaults_test.rb Active Record supports MySQL >= 5.0 2016-02-04 07:08:33 +09:00
dirty_test.rb systematic revision of =~ usage in AR 2016-07-23 20:22:20 +02:00
disconnected_test.rb
dup_test.rb
enum_test.rb return correct type from EnumType 2016-06-24 17:43:25 +09:00
errors_test.rb Make ActiveRecordException descendants args optional 2015-09-07 00:04:31 -07:00
explain_subscriber_test.rb
explain_test.rb Fix explain logging with binds 2016-07-20 15:26:39 +09:00
finder_respond_to_test.rb
finder_test.rb Prevent RangeError for FinderMethods#exists? 2016-06-16 06:25:37 +09:00
fixtures_test.rb Fix payload[:class_name] to payload[:spec_name] 2016-07-17 22:04:06 +09:00
forbidden_attributes_protection_test.rb Fix more test failures caused by #21000 2015-11-23 15:36:38 -07:00
habtm_destroy_order_test.rb
helper.rb Remove load_paths file 2016-02-27 13:03:57 -05:00
hot_compatibility_test.rb Make tests a bit more beautiful 2015-11-05 17:44:47 -03:00
i18n_test.rb
inheritance_test.rb Remove log-related stuff from ActiveSupport::Dependencies 2016-03-15 00:54:48 +01:00
integration_test.rb fix to_param to maximize content 2016-07-08 17:12:14 -04:00
invalid_connection_test.rb tests, don't connect to mysql when running sqlite3 tests. 2015-12-28 09:00:38 +01:00
invertible_migration_test.rb Respect options passed to foreign_key when reverting add_reference 2016-05-31 12:55:02 -04:00
json_serialization_test.rb
locking_test.rb Followup of #15771 2016-04-24 04:01:18 +05:30
log_subscriber_test.rb Fix ActiveRecord::LogSubscriber edge case 2016-05-10 15:42:07 -04:00
migration_test.rb Revert "Rename active_record_internal_metadatas to ar_internal_metadata" 2016-07-01 17:38:52 +00:00
migrator_test.rb Internal test migrations use the private 'Current' version 2015-12-15 17:18:09 +10:30
mixin_test.rb travel/travel_to travel time helpers, now raise on nested calls, 2016-07-02 15:09:34 -07:00
modules_test.rb remove args from assert_nothing_raised in tests 2016-02-22 22:56:23 -08:00
multiparameter_attributes_test.rb Fixes multiparameter attributes conversion with time_zone_aware_attributes and invalid params 2016-07-19 22:35:45 +09:00
multiple_db_test.rb s/specification_name/connection_specification_name 2016-05-06 13:22:49 -05:00
nested_attributes_test.rb remove args from assert_nothing_raised in tests 2016-02-22 22:56:23 -08:00
nested_attributes_with_callbacks_test.rb
persistence_test.rb Typos in AR tests 2016-02-03 22:08:13 +09:00
pooled_connections_test.rb Deprecate #table_exists?, #tables and passing arguments to #talbes 2015-11-09 23:13:23 +09:00
primary_keys_test.rb Move the warning about composite primary key to AttributeMethods::PrimaryKey 2016-07-02 15:21:02 +09:00
query_cache_test.rb Fix payload[:class_name] to payload[:spec_name] 2016-07-17 22:04:06 +09:00
quoting_test.rb Support for unified Integer class in Ruby 2.4+ 2016-05-18 21:58:51 -07:00
readonly_test.rb
reaper_test.rb
reflection_test.rb When verifying size of relation, also verify count is ok. 2016-01-25 13:41:21 +05:30
relation_test.rb activerecord: reuse immutable objects 2016-01-04 12:09:37 -05:00
relations_test.rb Merge pull request #24203 from sferik/count_with_block 2016-05-16 20:39:28 +02:00
reload_models_test.rb
result_test.rb Optimize ActiveRecord::Result#last 2016-06-24 11:43:48 +02:00
sanitize_test.rb Merge pull request #22209 from yui-knk/add_test_sanitize_sql_array_handles_named_bind_variables 2015-12-14 07:42:32 -07:00
schema_dumper_test.rb Do not include default column limit in schema.rb 2016-05-31 23:22:07 +09:00
schema_loading_test.rb rm unused require 2016-04-29 19:33:50 -07:00
secure_token_test.rb Revert "Merge pull request #20835 from glittershark/if-and-unless-in-secure-token" 2016-01-14 21:52:03 +01:00
serialization_test.rb
serialized_attribute_test.rb Fix false positive mutation detection when JSON is used with serialize 2016-05-12 09:09:47 -04:00
statement_cache_test.rb Prepared statements shouldn't share a cache with unprepared statements 2016-03-31 13:41:36 -06:00
store_test.rb Test parent local_stored_attributes isn't modified 2016-02-16 11:42:04 -05:00
suppressor_test.rb Keep state around for nested calls to #suppress 2016-05-16 14:07:32 -04:00
test_case.rb adds missing requires 2016-07-24 21:29:29 +02:00
test_fixtures_test.rb 🔪 Typos 2015-09-21 03:17:39 +09:00
time_precision_test.rb Add quoted_time for truncating the date part of a time column value 2016-04-14 14:22:16 +09:00
timestamp_test.rb Fix assert_in_delta test failure 2016-02-06 23:15:22 +09:00
touch_later_test.rb travel back 2015-12-13 11:34:40 +09:00
transaction_callbacks_test.rb Fix corrupt transaction state caused by before_commit exceptions 2016-02-01 14:12:49 -07:00
transaction_isolation_test.rb
transactions_test.rb Allow add_to_transaction with null transaction 2015-12-28 14:28:19 -08:00
type_test.rb
types_test.rb Move the appropriate type tests to the Active Model suite 2015-09-21 10:12:31 -06:00
unconnected_test.rb
validations_repair_helper.rb
validations_test.rb remove args from assert_nothing_raised in tests 2016-02-22 22:56:23 -08:00
view_test.rb Remove legacy mysql adapter 2015-12-17 15:54:57 +00:00
yaml_serialization_test.rb Make Active Record emit significantly smaller YAML 2016-05-31 14:58:43 -04:00