Sha256: 8e648d1dc4ae8d869ae1d4642c56986720e7e50ffe3634d2fa9b1120747585e4
Contents?: true
Size: 1.44 KB
Versions: 2
Compression:
Stored size: 1.44 KB
Contents
require 'fileutils' module RailsHelper def rails_root @rails_root = TEST_RAILS_ROOT end def delete_cached_assets! Dir[File.join(rails_root, 'public/javascripts/cache'), File.join(rails_root, 'public/stylesheets/cache')].each do |dir| FileUtils.rm_rf(dir) end end def initialize_application_or_load_sprites! if Rails.application && initialized? load_sprites! elsif Rails.application && !initialized? initialize_application! end end def initialize_application_or_load_expansions! if Rails.application && (Rails.version.to_i < 3 || Rails.application.instance_variable_defined?(:@ran)) load_assets! elsif !(Rails.application && Rails.application.instance_variable_defined?(:@ran)) initialize_application! end end def load_assets! if File.exists?(File.join(rails_root, 'config/assets.rb')) load File.join(rails_root, 'config/assets.rb') elsif File.directory?(File.join(rails_root, 'config/assets')) Dir[File.join(rails_root, 'config/assets/*.rb')].each do |f| load f end end end def load_sprites! load File.join(rails_root, 'config/sprites.rb') if File.exists?(File.join(rails_root, 'config/sprites.rb')) end def initialize_application! if Rails.version.to_i >= 3 ActiveAssetsTest::Application.initialize! end end def initialized? Rails.version.to_i < 3 || Rails.application.instance_variable_defined?(:@ran) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active_assets-0.3.1 | test/support/rails_helper.rb |
active_assets-0.3.0 | test/support/rails_helper.rb |