Sha256: 97de006bf02a4eca5f8313577b0ef2508db63999c51d3d835e8caed1e7a4bc86

Contents?: true

Size: 886 Bytes

Versions: 28

Compression:

Stored size: 886 Bytes

Contents

module JetfuelTestHelpers
  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_jetfuel(arguments = nil)
    Dir.chdir(tmp_path) do
      Bundler.with_clean_env do
        ENV['TESTING'] = '1'

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

  def drop_dummy_database
    if File.exists?(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 jetfuel_bin
    File.join(root_path, 'bin', 'jetfuel')
  end

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

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
jetfuel-1.19.24 spec/support/jetfuel.rb
jetfuel-1.19.23 spec/support/jetfuel.rb
jetfuel-1.19.22 spec/support/jetfuel.rb
jetfuel-1.19.21 spec/support/jetfuel.rb
jetfuel-1.19.20 spec/support/jetfuel.rb
jetfuel-1.19.19 spec/support/jetfuel.rb
jetfuel-1.19.18 spec/support/jetfuel.rb
jetfuel-1.19.17 spec/support/jetfuel.rb
jetfuel-1.19.16 spec/support/jetfuel.rb
jetfuel-1.19.15 spec/support/jetfuel.rb
jetfuel-1.19.14 spec/support/jetfuel.rb
jetfuel-1.19.13 spec/support/jetfuel.rb
jetfuel-1.19.12 spec/support/jetfuel.rb
jetfuel-1.19.11 spec/support/jetfuel.rb
jetfuel-1.19.10 spec/support/jetfuel.rb
jetfuel-1.19.9 spec/support/jetfuel.rb
jetfuel-1.19.8 spec/support/jetfuel.rb
jetfuel-1.19.7 spec/support/jetfuel.rb
jetfuel-1.19.6 spec/support/jetfuel.rb
jetfuel-1.19.5 spec/support/jetfuel.rb