Sha256: e06c22fd7988c2ba70f7287b00aab6fd48f0851fac734cd0d8deb6acc88f6893

Contents?: true

Size: 839 Bytes

Versions: 2

Compression:

Stored size: 839 Bytes

Contents

module RailsEdgeTest
  module Runner
    module_function
    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).each do |file|
        load file
      end

      RailsEdgeTest::Dsl.execute!
    end

    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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_edge_test-1.1.0 lib/rails_edge_test/runner.rb
rails_edge_test-0.8.0 lib/rails_edge_test/runner.rb