Sha256: 26678c3d00f47a955bf3296a41d0fe0d6b1b85d8141158dc6f01c753f0c2e38e

Contents?: true

Size: 895 Bytes

Versions: 5

Compression:

Stored size: 895 Bytes

Contents

module JumpstartTestHelpers
  APP_NAME = 'dummy'

  def remove_project_directory
    FileUtils.rm_rf(project_path)
  end

  def create_tmp_directory
    FileUtils.mkdir_p(tmp_path)
  end

  def run_jumpstart(arguments = nil)
    Dir.chdir(tmp_path) do
      Bundler.with_clean_env do
        ENV['TESTING'] = '1'

        %x(#{jumpstart_bin} #{APP_NAME} #{arguments})
      end
    end
  end

  def drop_dummy_database
    if File.exist?(project_path)
      Dir.chdir(project_path) do
        Bundler.with_clean_env do
          `rake db:drop`
        end
      end
    end
  end

  def project_path
    @project_path ||= Pathname.new("#{tmp_path}/#{APP_NAME}")
  end

  private

  def tmp_path
    @tmp_path ||= Pathname.new("#{root_path}/tmp")
  end

  def jumpstart_bin
    File.join(root_path, 'bin', 'jumpstart')
  end

  def root_path
    File.expand_path('../../../', __FILE__)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ajmalafif-jumpstart-1.18.8 spec/support/jumpstart.rb
ajmalafif-jumpstart-1.18.7 spec/support/jumpstart.rb
ajmalafif-jumpstart-1.18.6 spec/support/jumpstart.rb
ajmalafif-jumpstart-1.18.5 spec/support/jumpstart.rb
ajmalafif-jumpstart-1.18.4 spec/support/jumpstart.rb