Permalink
Browse files

Added RSpec test for correct handling of multi-column and function in…

…dexes.
  • Loading branch information...
1 parent c06c90b commit f0d596b3e8df0eef69a62229916f3671e46712c3 @cosine cosine committed Apr 9, 2012
Showing with 12 additions and 0 deletions.
  1. +12 −0 spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb
@@ -181,6 +181,18 @@ class ::TestPost < ActiveRecord::Base
dump.should =~ /CREATE INDEX "?IX_TEST_POSTS_FOO\"? ON "?TEST_POSTS"? \("?FOO"?\)/i
dump.should_not =~ /CREATE UNIQUE INDEX "?UK_TEST_POSTS_/i
end
+
+ it "should dump multi-value and function value indexes" do
+ ActiveRecord::Base.connection.add_index(:test_posts, [:foo, :foo_id], :name => :ix_test_posts_foo_foo_id)
+
+ @conn.execute <<-SQL
+ CREATE INDEX "IX_TEST_POSTS_FUNCTION" ON "TEST_POSTS" (TO_CHAR(LENGTH("FOO"))||"FOO")
+ SQL
+
+ dump = ActiveRecord::Base.connection.structure_dump
+ dump.should =~ /CREATE INDEX "?IX_TEST_POSTS_FOO_FOO_ID\"? ON "?TEST_POSTS"? \("?FOO"?, "?FOO_ID"?\)/i
+ dump.should =~ /CREATE INDEX "?IX_TEST_POSTS_FUNCTION\"? ON "?TEST_POSTS"? \(TO_CHAR\(LENGTH\("?FOO"?\)\)\|\|"?FOO"?\)/i
+ end
end
describe "temporary tables" do
after(:all) do

0 comments on commit f0d596b

Please sign in to comment.