Skip to content

Commit

Permalink
Remove remove_prefix_and_suffix and specs from Oracle enhanced adapter
Browse files Browse the repository at this point in the history
Since rails/rails#30048 there is no Oracle enhanced specific implementation anymore.
Tests are covered by `ActiveRecord::TestCase::SchemaDumperTest`

Refer rsim#1401 rails/rails#30044 rails/rails#30048
  • Loading branch information
yahonda committed Aug 16, 2017
1 parent 4afd4ea commit d6186e8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,6 @@ def table(table, stream)
stream
end

def remove_prefix_and_suffix(table)
prefix = Regexp.escape(@options[:table_name_prefix].to_s)
suffix = Regexp.escape(@options[:table_name_suffix].to_s)
table.sub(/\A(?:#{prefix})(.+)(?:#{suffix})\z/, "\\1")
end

def oracle_enhanced_adapter?
@connection.adapter_name.include?("Oracle")
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,52 +73,6 @@ def drop_test_posts_table
expect(standard_dump).to match(/t.string \"special_c\", default: "\\n"/)
end
end
describe "table prefixes and suffixes" do
after(:each) do
drop_test_posts_table
@conn.drop_table(ActiveRecord::SchemaMigration.table_name) if @conn.table_exists?(ActiveRecord::SchemaMigration.table_name)
@conn.drop_table(ActiveRecord::InternalMetadata.table_name) if @conn.table_exists?(ActiveRecord::InternalMetadata.table_name)
ActiveRecord::Base.table_name_prefix = ""
ActiveRecord::Base.table_name_suffix = ""
end

it "should remove table prefix in schema dump" do
ActiveRecord::Base.table_name_prefix = "xxx_"
create_test_posts_table
expect(standard_dump).to match(/create_table "test_posts"/m)
end

it "should remove table prefix with $ sign in schema dump" do
ActiveRecord::Base.table_name_prefix = "xxx$"
create_test_posts_table
expect(standard_dump).to match(/create_table "test_posts"/m)
end

it "should remove table suffix in schema dump" do
ActiveRecord::Base.table_name_suffix = "_xxx"
create_test_posts_table
expect(standard_dump).to match(/create_table "test_posts"/m)
end

it "should remove table suffix with $ sign in schema dump" do
ActiveRecord::Base.table_name_suffix = "$xxx"
create_test_posts_table
expect(standard_dump).to match(/create_table "test_posts"/m)
end

it "should not include schema_migrations table with prefix in schema dump" do
ActiveRecord::Base.table_name_prefix = "xxx_"
ActiveRecord::SchemaMigration.create_table
expect(standard_dump).not_to match(/schema_migrations/)
end

it "should not include schema_migrations table with suffix in schema dump" do
ActiveRecord::Base.table_name_suffix = "_xxx"
ActiveRecord::SchemaMigration.create_table
expect(standard_dump).not_to match(/schema_migrations/)
end

end

describe "table with non-default primary key" do
after(:each) do
Expand Down

0 comments on commit d6186e8

Please sign in to comment.