Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add failing spec for #318 #319

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions spec/chrono_model/adapter/migrations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,38 @@
end
end

describe '.add_reference' do
with_temporal_table do
before do
adapter.add_reference table, :foo
end

it { is_expected.to have_columns([%w[foo_id bigint]]) }
it { is_expected.to have_temporal_columns([%w[foo_id bigint]]) }
it { is_expected.to have_history_columns([%w[foo_id bigint]]) }

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_columns([%w[foo_id bigint]]) }
it { is_expected.to have_temporal_columns([%w[foo_id bigint]]) }
it { is_expected.to have_history_columns([%w[foo_id bigint]]) }

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
Expand Down
Loading