From 3591ab228b24343e1120406958eee7bdf2ab2585 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Wed, 24 Jul 2024 14:27:39 +0200 Subject: [PATCH] Add failing spec for #318 --- spec/chrono_model/adapter/migrations_spec.rb | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/spec/chrono_model/adapter/migrations_spec.rb b/spec/chrono_model/adapter/migrations_spec.rb index afe30321..27ed8e9a 100644 --- a/spec/chrono_model/adapter/migrations_spec.rb +++ b/spec/chrono_model/adapter/migrations_spec.rb @@ -215,6 +215,30 @@ end end + describe '.add_reference' do + with_temporal_table do + before do + adapter.add_reference table, :foo + end + + it { is_expected.to have_temporal_index 'index_test_table_on_foo_id', %w[foo_id] } + it { is_expected.to have_history_index 'index_test_table_on_foo_id', %w[foo_id] } + end + end + + describe '.references' do + with_temporal_table do + before do + adapter.create_table table, force: true, temporal: true do |t| + t.references :foo + end + end + + it { is_expected.to have_temporal_index 'index_test_table_on_foo_id', %w[foo_id] } + it { is_expected.to have_history_index 'index_test_table_on_foo_id', %w[foo_id] } + end + end + describe '.add_index' do with_temporal_table do before do