Sha256: 672f3621e67f35fe23c586ce8f64cefdf0059e0889e27e39b1579d3ee9d259b0
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 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| def self.set_constant( const, value ) eval( "Kernel.const_set :#{const.to_s}, #{value.inspect} unless defined?( #{const.to_s} )" ) end set_constant( :FIXTURES, "#{Dir.pwd}/spec/fixtures" ) set_constant( :TMP, "#{Dir.pwd}/spec/tmp" ) set_constant( :CONFIG, "#{Dir.pwd}/spec/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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
methodmissing-scrooge-1.0.3 | spec/spec_helper.rb |
methodmissing-scrooge-1.0.4 | spec/spec_helper.rb |