Skip to content

Commit

Permalink
add spec
Browse files Browse the repository at this point in the history
  • Loading branch information
martinschaflitzl1 committed Dec 21, 2023
1 parent 3922554 commit 1c7d213
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions spec/active_type/util_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 1c7d213

Please sign in to comment.