Sha256: b6e2bb3624dc295ea8adb8887fe0fe6b7a668472e72bc5ba92bafcd8d700fa08

Contents?: true

Size: 834 Bytes

Versions: 3

Compression:

Stored size: 834 Bytes

Contents

require 'rspec_for_generators/rails_helpers/all'

module TmpRails
  class << self    
    attr_accessor :root
    
    def root_dir path, options = {}
      @root = options == :custom ? custom_root_dir(path) : default_root_dir(path)      
    end

    protected

    def default_root_dir path
      File.expand_path(File.join(File.dirname(path), '..', 'tmp'))      
    end

    def custom_root_dir path
      File.expand_path(path)
    end
  end
end  
  
module Rails
  def self.root
    # raise StandardError, "You must define a location for Rails.config_root_dir" if !Rails.config_root_dir    
    # @root ||= File.expand_path(File.join(Rails.config_root_dir, '..', 'tmp', 'rails'))
    @root ||= File.join(Rails.application.config.root_dir, 'rails')
  end
end

class TestApp < Rails::Application
end

Rails.application = TestApp

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
generator-spec-0.3.3 lib/rspec_for_generators/rails_spec_helper.rb
rspec_for_generators-0.3.1 lib/rspec_for_generators/rails_spec_helper.rb
rspec_for_generators-0.3.0 lib/rspec_for_generators/rails_spec_helper.rb