diff --git a/spec/active_type/util_spec.rb b/spec/active_type/util_spec.rb index d8fb38a..7b60c02 100644 --- a/spec/active_type/util_spec.rb +++ b/spec/active_type/util_spec.rb @@ -267,6 +267,13 @@ class AssociatedRecord < ActiveRecord::Base end.not_to raise_error end + it 'still allows to access the attributes of the original record after cast via #attributes' do + base_record = UtilSpec::BaseRecord.create!(persisted_string: 'foo') + ActiveType::Util.cast(base_record, UtilSpec::ExtendedRecord) + + expect(base_record.attributes).to eq({ 'persisted_string' => 'foo'}) + end + context 'with option force: true' do it 'will not prevent changing or saving it' do base_record = UtilSpec::BaseRecord.create!(:persisted_string => 'old value')