test/support/isolation_abstract_unit.rb
# Build an application by invoking the generator and going through the whole stack.
Build an application by invoking the generator and going through the whole stack.
Build an application by invoking the generator and going through the whole stack .
def build_app(options = {})
      @prev_rails_env = ENV['RAILS_ENV']
      ENV['RAILS_ENV'] = 'development'
      FileUtils.rm_rf(app_path)
      FileUtils.cp_r(app_template_path, app_path)
      unless options[:initializers]
        Dir["#{app_path}/config/initializers/*.rb"].each do |initializer|
          File.delete(initializer)
        end
      end
      gemfile_path = "#{app_path}/Gemfile"
      if options[:gemfile].blank? && File.exist?(gemfile_path)
        File.delete gemfile_path
      end
      routes = File.read("#{app_path}/config/routes.rb")
      if routes =~ /(\n\s*end\s*)\Z/
        File.open("#{app_path}/config/routes.rb", 'w') do |f|
          f.puts $` + "\nmatch ':controller(/:action(/:id))(.:format)', via: :all\n" + $1
        end
      end
      add_to_config <<-RUBY
        config.eager_load = false
        config.secret_token = "3b7cd727ee24e8444053437c36cc66c4"
        config.session_store :cookie_store, key: "_myapp_session"
        config.active_support.deprecation = :log
        config.action_controller.allow_forgery_protection = false
      RUBY
    end
def build_app ( options = { } ) @prev_rails_env = ENV [ 'RAILS_ENV' ] ENV [ 'RAILS_ENV' ] = 'development' FileUtils . rm_rf ( app_path ) FileUtils . cp_r ( app_template_path , app_path ) unless options [ :initializers ] Dir [ "#{app_path}/config/initializers/*.rb" ] . each do | initializer | File . delete ( initializer ) end end gemfile_path = "#{app_path}/Gemfile" if options [ :gemfile ] . blank? && File . exist? ( gemfile_path ) File . delete gemfile_path end routes = File . read ( "#{app_path}/config/routes.rb" ) if routes =~ / ( \n \s *end \s *) \Z / File . open ( "#{app_path}/config/routes.rb" , 'w' ) do | f | f . puts $` + "\nmatch ':controller(/:action(/:id))(.:format)', via: :all\n" + $1 end end add_to_config <<-RUBY 
        config.eager_load = false
        config.secret_token = "3b7cd727ee24e8444053437c36cc66c4"
        config.session_store :cookie_store, key: "_myapp_session"
        config.active_support.deprecation = :log
        config.action_controller.allow_forgery_protection = false
       RUBY end
Build an application by invoking the generator and going through the whole stack.
Build an application by invoking the generator and going through the whole stack .
# Delete the initializers unless requested
options
<not_specific>