aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/test/support/integration/helper.rb
diff options
context:
space:
mode:
authorCristian Bica <cristian.bica@gmail.com>2014-08-18 10:19:41 +0300
committerCristian Bica <cristian.bica@gmail.com>2014-09-11 00:38:56 +0300
commit175ba6666453684bba3c24d03b75580a1f8e68bb (patch)
tree1d89d3d7452428eb0c11358b8ae37e4363030509 /activejob/test/support/integration/helper.rb
parent467e5700e6c759276406d8dc3604ede2c86235cb (diff)
downloadrails-175ba6666453684bba3c24d03b75580a1f8e68bb.tar.gz
rails-175ba6666453684bba3c24d03b75580a1f8e68bb.tar.bz2
rails-175ba6666453684bba3c24d03b75580a1f8e68bb.zip
ActiveJob Integration Tests
Diffstat (limited to 'activejob/test/support/integration/helper.rb')
-rw-r--r--activejob/test/support/integration/helper.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/activejob/test/support/integration/helper.rb b/activejob/test/support/integration/helper.rb
new file mode 100644
index 0000000000..ccd5036b36
--- /dev/null
+++ b/activejob/test/support/integration/helper.rb
@@ -0,0 +1,32 @@
+puts "\n\n"
+puts "*** Running integration tests for #{ENV['AJADAPTER']} ***"
+puts "\n\n"
+
+ENV["RAILS_ENV"] = "test"
+ActiveJob::Base.queue_name_prefix = nil
+
+require 'rails/generators/rails/app/app_generator'
+
+dummy_app_path = Dir.mktmpdir + "/dummy"
+dummy_app_template = File.expand_path("../dummy_app_template.rb", __FILE__)
+args = Rails::Generators::ARGVScrubber.new(["new", dummy_app_path, "--skip-gemfile", "--skip-bundle",
+ "--skip-git", "--skip-spring", "-d", "sqlite3", "--skip-javascript", "--force", "--quite",
+ "--template", dummy_app_template]).prepare!
+Rails::Generators::AppGenerator.start args
+
+require "#{dummy_app_path}/config/environment.rb"
+
+ActiveRecord::Migrator.migrations_paths = [ Rails.root.join('db/migrate').to_s ]
+require 'rails/test_help'
+
+Rails.backtrace_cleaner.remove_silencers!
+
+require_relative 'test_case_helpers'
+ActiveSupport::TestCase.send(:include, TestCaseHelpers)
+
+JobsManager.current_manager.start_workers
+
+Minitest.after_run do
+ JobsManager.current_manager.stop_workers
+ JobsManager.current_manager.clear_jobs
+end