Sha256: 76c973732001e8ab71601691c3542048bfa69e7f43c0842eeba050c1abc24af3
Contents?: true
Size: 1.28 KB
Versions: 2
Compression:
Stored size: 1.28 KB
Contents
require "teaspoon/exceptions" module Teaspoon module Environment def self.load(options = {}) require_environment(options[:environment]) raise "Rails environment not found." unless rails_loaded? require "teaspoon" require "teaspoon/server" require "teaspoon/runner" require "teaspoon/coverage" require "teaspoon/exporter" Teaspoon.configuration.override_from_options(options) Teaspoon::ExceptionHandling.add_rails_handling end def self.require_environment(override = nil) override ||= ENV["TEASPOON_ENV"] if override override = File.expand_path(override, Dir.pwd) ENV["TEASPOON_ENV"] = override return require_env(override) end standard_environments.each do |filename| file = File.expand_path(filename, Dir.pwd) return require_env(file) if File.exists?(file) end raise Teaspoon::EnvironmentNotFound, "Unable to load Teaspoon environment in {#{standard_environments.join(', ')}}" end def self.standard_environments ["spec/teaspoon_env.rb", "test/teaspoon_env.rb", "teaspoon_env.rb"] end private def self.require_env(file) ::Kernel.load(file) end def self.rails_loaded? defined?(Rails) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
teaspoon-0.9.1 | lib/teaspoon/environment.rb |
teaspoon-0.9.0 | lib/teaspoon/environment.rb |