Sha256: ddee9102d7f219c43cff6da11ec741264ea68580ef0b955bb814ab5ca7a4d833
Contents?: true
Size: 1.3 KB
Versions: 3
Compression:
Stored size: 1.3 KB
Contents
$:.unshift File.dirname(__FILE__) + '/../lib' require 'rubygems' require 'fileutils' require 'logger' require 'stringio' require 'lib/scrooge' require 'spec/helpers/framework/rails/cache' #ActiveRecord::Base.logger = Logger.new(StringIO.new) Spec::Runner.configure do |config| Kernel.const_set :FIXTURES, "#{Dir.pwd}/spec/fixtures" unless defined?(FIXTURES) Kernel.const_set :TMP, "#{Dir.pwd}/spec/tmp" unless defined?(TMP) Kernel.const_set :CONFIG, "#{Dir.pwd}/spec/config" unless defined?(CONFIG) config.before :all do [TMP, CONFIG].each do |dir| FileUtils.mkdir_p dir end end config.before :each do end config.after :each do end config.after :all do [TMP, CONFIG].each do |dir| FileUtils.rm_r( dir ) rescue nil end end def with_rails begin Kernel.const_set :RAILS_ROOT, "#{Dir.pwd}/spec" unless defined?(RAILS_ROOT) Kernel.const_set :Rails, Class.new unless defined?(Rails) Kernel.const_set :RAILS_ENV, "test" unless defined?(RAILS_ENV) ::Rails.stub!(:cache).and_return( Spec::Helpers::Framework::Rails::Cache.new ) ::Rails.stub!(:root).and_return( RAILS_ROOT ) yield ensure [:RAILS_ROOT, :RAILS_ENV, :Rails].each do |const| Kernel.send( :remove_const, const ) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
methodmissing-scrooge-1.0.0 | spec/spec_helper.rb |
methodmissing-scrooge-1.0.1 | spec/spec_helper.rb |
methodmissing-scrooge-1.0.2 | spec/spec_helper.rb |