Skip to content

Commit

Permalink
Add specs for add_index without name
Browse files Browse the repository at this point in the history
  • Loading branch information
tagliala committed Dec 1, 2021
1 parent 8fe763d commit e28b73d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions spec/chrono_model/adapter/migrations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,30 +199,38 @@
before :all do
adapter.add_index table, [:foo, :bar], :name => 'foobar_index'
adapter.add_index table, [:test], :name => 'test_index'
adapter.add_index table, :baz
end

it { is_expected.to have_temporal_index 'foobar_index', %w( foo bar ) }
it { is_expected.to have_history_index 'foobar_index', %w( foo bar ) }
it { is_expected.to have_temporal_index 'test_index', %w( test ) }
it { is_expected.to have_history_index 'test_index', %w( test ) }
it { is_expected.to have_temporal_index 'index_test_table_on_baz', %w( baz ) }
it { is_expected.to have_history_index 'index_test_table_on_baz', %w( baz ) }

it { is_expected.to_not have_index 'foobar_index', %w( foo bar ) }
it { is_expected.to_not have_index 'test_index', %w( test ) }
it { is_expected.to_not have_index 'index_test_table_on_baz', %w( baz ) }
end

with_plain_table do
before :all do
adapter.add_index table, [:foo, :bar], :name => 'foobar_index'
adapter.add_index table, [:test], :name => 'test_index'
adapter.add_index table, :baz
end

it { is_expected.to_not have_temporal_index 'foobar_index', %w( foo bar ) }
it { is_expected.to_not have_history_index 'foobar_index', %w( foo bar ) }
it { is_expected.to_not have_temporal_index 'test_index', %w( test ) }
it { is_expected.to_not have_history_index 'test_index', %w( test ) }
it { is_expected.to_not have_temporal_index 'index_test_table_on_baz', %w( baz ) }
it { is_expected.to_not have_history_index 'index_test_table_on_baz', %w( baz ) }

it { is_expected.to have_index 'foobar_index', %w( foo bar ) }
it { is_expected.to have_index 'test_index', %w( test ) }
it { is_expected.to have_index 'index_test_table_on_baz', %w( baz ) }
end
end

Expand Down

0 comments on commit e28b73d

Please sign in to comment.