Module: RailsEdgeTest::Runner

Defined in:
lib/rails_edge_test/runner.rb

Class Method Summary collapse

Class Method Details

.go!(args = []) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rails_edge_test/runner.rb', line 4

def go!(args = [])
  unless Rails.env.test?
    puts "Failure! Unable to set Rails environment to test."
    exit
  end

  RailsEdgeTest::Dsl.reset!

  glob_path = '**/*_edge.rb'

  if args.length > 0
    glob_path = args.shift
  end

  glob = File.join(
    RailsEdgeTest.configuration.edge_root_path,
    glob_path
  )

  Dir.glob(glob).each do |file|
    load file
  end

  RailsEdgeTest::Dsl.execute!
end

.load_rails_environment!(rails_root) ⇒ Object



30
31
32
33
34
35
36
37
38
39
# File 'lib/rails_edge_test/runner.rb', line 30

def load_rails_environment!(rails_root)
  ENV["RAILS_ENV"]="test"
  rails_app_path = File.join(rails_root, "config/application")
  require rails_app_path

  Rails.application.require_environment!

  require "rake"
  Rails.application.load_tasks
end