Sha256: a0be8e5be2a559950cb9b2681c50223cfdb93e74d73ce23a4efb36f3b529a1be
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
module RailsTestServing module Bootstrap SOCKET_PATH = ['tmp', 'sockets', 'test_server.sock'] def boot(argv=ARGV) if argv.delete('--serve') start_server elsif !argv.delete('--local') Client.run_tests end end def service_uri @service_uri ||= begin # Determine RAILS_ROOT root, max_depth = Pathname('.'), Pathname.pwd.expand_path.to_s.split(File::SEPARATOR).size until root.join('config', 'boot.rb').file? root = root.parent if root.to_s.split(File::SEPARATOR).size >= max_depth raise "RAILS_ROOT could not be determined" end end root = root.cleanpath # Adjust load path $: << root.to_s << root.join('test').to_s # Ensure socket directory exists path = root.join(*SOCKET_PATH) path.dirname.mkpath # URI "drbunix:#{path}" end end def options @options ||= begin options = $test_server_options || {} options[:reload] ||= [] options end end def active? @active end private def start_server @active = true Server.start ensure @active = false end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
Roman2K-rails-test-serving-0.1.4.1 | lib/rails_test_serving/bootstrap.rb |
rails-test-serving-0.1.4.2 | lib/rails_test_serving/bootstrap.rb |