Skip to content

Instantly share code, notes, and snippets.

@shimar
Last active February 17, 2017 01:45
Show Gist options
  • Save shimar/b184cdb21b9a0cdc285769852e899822 to your computer and use it in GitHub Desktop.
Save shimar/b184cdb21b9a0cdc285769852e899822 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'test_queue'
require 'test_queue/runner/rspec'
class RSpecQueueRunner < TestQueue::Runner::RSpec
def after_fork(num)
ENV.update('TEST_ENV_NUMBER' => num.to_s)
ActiveRecord::Base.configurations['test']['database'] << num.to_s
ActiveRecord::Base.establish_connection(:test)
ActiveRecord::Tasks::DatabaseTasks.drop_current
ActiveRecord::Tasks::DatabaseTasks.create_current
ActiveRecord::Tasks::DatabaseTasks.load_schema_current
end
end
RSpecQueueRunner.new.execute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment