@@ -1040,15 +1040,15 @@ class EmployeeWithUniquness < Employee
10401040 @swapped_id_before_destroy = employee . swapped_id
10411041 end
10421042
1043- it { is_expected . not_to change ( employee , :valid_to ) }
10441043 it { is_expected . to change ( Employee , :call_before_destroy_count ) . by ( 1 ) }
10451044 it { is_expected . to change ( Employee , :call_after_destroy_count ) . by ( 1 ) }
10461045 it { is_expected . to change ( Employee , :call_after_save_count ) }
10471046 it { is_expected . to change ( Employee , :count ) . by ( -1 ) }
10481047 it { is_expected . to change ( employee , :destroyed? ) . from ( false ) . to ( true ) }
10491048 it { is_expected . not_to change ( employee , :valid_from ) }
1050- it { is_expected . not_to change ( employee , :valid_to ) }
1051- it { is_expected . to change ( employee , :transaction_to ) . from ( ActiveRecord ::Bitemporal ::DEFAULT_TRANSACTION_TO ) . to ( destroyed_time ) }
1049+ it { is_expected . to change ( employee , :valid_to ) . from ( ActiveRecord ::Bitemporal ::DEFAULT_VALID_TO ) . to ( destroyed_time ) }
1050+ it { is_expected . to change ( employee , :transaction_from ) . from ( updated_time ) . to ( destroyed_time ) }
1051+ it { is_expected . not_to change ( employee , :transaction_to ) }
10521052 it { is_expected . to change { Employee . ignore_valid_datetime . within_deleted . count } . by ( 1 ) }
10531053 it { is_expected . to change ( employee , :swapped_id ) . from ( @swapped_id_before_destroy ) . to ( kind_of ( Integer ) ) }
10541054 it { is_expected . to change ( employee , :swapped_id_previously_was ) . from ( kind_of ( Integer ) ) . to ( @swapped_id_before_destroy ) }
@@ -1174,7 +1174,7 @@ class EmployeeWithUniquness < Employee
11741174 employee . define_singleton_method ( :on_after_destroy ) {
11751175 valid_to = self . valid_to
11761176 # After update valid_to
1177- self_ . instance_exec { expect ( valid_to ) . to eq before_time }
1177+ self_ . instance_exec { expect ( valid_to ) . to eq destroyed_time }
11781178 }
11791179 subject . call
11801180 end
@@ -1190,8 +1190,11 @@ class EmployeeWithUniquness < Employee
11901190 end
11911191
11921192 context "with `#valid_at`" do
1193- subject { -> { Timecop . freeze ( destroyed_time ) { employee . valid_at ( destroyed_time + 1 . days , &:destroy ) } } }
1194- it { is_expected . to change ( employee , :transaction_to ) . from ( ActiveRecord ::Bitemporal ::DEFAULT_TRANSACTION_TO ) . to ( destroyed_time ) }
1193+ subject { -> { Timecop . freeze ( destroyed_time ) { employee . valid_at ( destroyed_time + 1 . day , &:destroy ) } } }
1194+ it { is_expected . not_to change ( employee , :valid_from ) }
1195+ it { is_expected . to change ( employee , :valid_to ) . from ( ActiveRecord ::Bitemporal ::DEFAULT_VALID_TO ) . to ( destroyed_time + 1 . day ) }
1196+ it { is_expected . to change ( employee , :transaction_from ) . from ( updated_time ) . to ( destroyed_time ) }
1197+ it { is_expected . not_to change ( employee , :transaction_to ) }
11951198 end
11961199 end
11971200
0 commit comments