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
# 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!

  paths_to_load =
    if args.any?
      args
    else
      File.join(
        RailsEdgeTest.configuration.edge_root_path,
        '**/*_edge.rb'
      )
    end

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

  RailsEdgeTest::Dsl.execute!
end

.load_rails_environment!(rails_root) ⇒ Object



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

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