Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
seuros committed Jan 18, 2024
1 parent dee7b57 commit 30fdabc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
5 changes: 0 additions & 5 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@ def sqlite?
# Require our gem
require 'closure_tree'

ActiveRecord::Tasks::DatabaseTasks.drop_current(:primary)
ActiveRecord::Tasks::DatabaseTasks.create_current(:primary)
ActiveRecord::Tasks::DatabaseTasks.drop_current(:secondary)
ActiveRecord::Tasks::DatabaseTasks.create_current(:secondary)

# Load test helpers
require_relative 'support/schema'
require_relative 'support/models'
Expand Down
8 changes: 8 additions & 0 deletions spec/support/schema.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true



class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true

Expand All @@ -12,6 +14,12 @@ class SecondDatabaseRecord < ActiveRecord::Base
connects_to database: { writing: :secondary, reading: :secondary }
end

ActiveRecord::Tasks::DatabaseTasks.drop(:primary)
ActiveRecord::Tasks::DatabaseTasks.create(:primary)
ActiveRecord::Tasks::DatabaseTasks.drop(:secondary)
ActiveRecord::Tasks::DatabaseTasks.create(:secondary)

ApplicationRecord.establish_connection
ActiveRecord::Schema.define(version: 0) do
connection.create_table 'tags', force: :cascade do |t|
t.string 'name'
Expand Down
5 changes: 1 addition & 4 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,7 @@ class Spec
Thread.abort_on_exception = true

require 'closure_tree'
ActiveRecord::Tasks::DatabaseTasks.drop_current(:primary)
ActiveRecord::Tasks::DatabaseTasks.create_current(:primary)
ActiveRecord::Tasks::DatabaseTasks.drop_current(:secondary)
ActiveRecord::Tasks::DatabaseTasks.create_current(:secondary)


require_relative '../spec/support/schema'
require_relative '../spec/support/models'
Expand Down

0 comments on commit 30fdabc

Please sign in to comment.