spec/spec_helper.rb in yaml2env-0.1.2 vs spec/spec_helper.rb in yaml2env-0.2.0
- old
+ new
@@ -1,16 +1,61 @@
# -*- encoding: utf-8 -*-
-require 'rubygems'
-require 'bundler'
-Bundler.require
-
require 'minitest/autorun'
require 'minitest/unit'
require 'minitest/spec'
require 'minitest/pride'
require 'minitest/mock'
+require 'mocha'
require 'yaml2env'
+
+def rack!(loaded)
+ if loaded
+ ::ENV['RACK_ROOT'] = '/home/grimen/development/rack_app'
+ ::ENV['RACK_ENV'] = 'rack_env'
+ else
+ ::ENV['RACK_ROOT'] = nil
+ ::ENV['RACK_ENV'] = nil
+ end
+end
+
+def rails!(loaded)
+ if loaded
+ eval <<-EVAL
+ unless defined?(::Rails)
+ module ::Rails
+ class << self
+ attr_accessor :root, :env
+ end
+ end
+ end
+ EVAL
+ Rails.root = '/home/grimen/development/rails_app'
+ Rails.env = 'rails_env'
+ else
+ Object.send(:remove_const, :Rails) if defined?(::Rails)
+ end
+end
+
+def sinatra!(loaded)
+ if loaded
+ eval <<-EVAL
+ unless defined?(::Sinatra::Application)
+ module ::Sinatra
+ class Application
+ class << self
+ attr_accessor :root, :environment
+ end
+ end
+ end
+ end
+ EVAL
+ Sinatra::Application.root = '/home/grimen/development/sinatra_app'
+ Sinatra::Application.environment = 'sinatra_env'
+ else
+ Object.send(:remove_const, :Sinatra) if defined?(::Sinatra::Application)
+ end
+end
def silence_all_warnings
# Ruby 1.8: Kernel.silence_warnings { yield }
old_verbose = $VERBOSE
$VERBOSE = nil