1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actioncable/Rakefile
Matthew Draper 287920ca7d Respect ENV variables when finding DBs etc for the test suite
If they're not set we'll still fall back to localhost, but this makes it
possible to run the tests against a remote Postgres / Redis / whatever.
2019-02-06 01:20:06 +10:30

44 lines
1 KiB
Ruby

# frozen_string_literal: true
require "base64"
require "rake/testtask"
require "pathname"
require "open3"
require "action_cable"
task default: :test
task :package
Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = Dir.glob("#{__dir__}/test/**/*_test.rb")
t.warning = true
t.verbose = true
t.ruby_opts = ["--dev"] if defined?(JRUBY_VERSION)
end
namespace :test do
task :isolated do
Dir.glob("test/**/*_test.rb").all? do |file|
sh(Gem.ruby, "-w", "-Ilib:test", file)
end || raise("Failures")
end
task :integration do
system(Hash[*Base64.decode64(ENV.fetch("ENCODED", "")).split(/[ =]/)], "yarn", "test")
exit($?.exitstatus) unless $?.success?
end
end
namespace :assets do
desc "Generate ActionCable::INTERNAL JS module"
task :codegen do
require "json"
require "action_cable"
File.open(File.join(__dir__, "app/javascript/action_cable/internal.js").to_s, "w+") do |file|
file.write("export default #{JSON.generate(ActionCable::INTERNAL)}")
end
end
end