Sha256: 6baa819acaac237b7549314088a0cb9ac2d20b11c24ec8c73bd230d6c5e46251

Contents?: true

Size: 1021 Bytes

Versions: 7

Compression:

Stored size: 1021 Bytes

Contents

# encoding: UTF-8

require "gjp"
require "gjp/logger"

Gjp::Logger.log.level = ::Logger::DEBUG

# custom mock methods
module Gjp::Mockers
  # creates a minimal gjp project
  def create_mock_project
    @project_path = File.join("spec", "data", "test-project")
    Dir.mkdir(@project_path)

    Gjp::Project.init(@project_path)
    @project = Gjp::Project.new(@project_path)
  end

  # deletes the mock project and all contents
  def delete_mock_project
    FileUtils.rm_rf(@project_path)
  end

  # creates an executable in kit that will print its parameters
  # in a test_out file for checking. Returns mocked executable
  # full path
  def create_mock_executable(executable_name)
    Dir.chdir(@project_path) do
      bin_dir = File.join("kit", executable_name, "bin")
      FileUtils.mkdir_p(bin_dir)
      executable_path = File.join(bin_dir, executable_name)
      File.open(executable_path, "w") { |io| io.puts "echo $0 $*>test_out" }
      File.chmod(0777, executable_path)
      executable_path
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gjp-0.36.0 spec/spec_helper.rb
gjp-0.35.0 spec/spec_helper.rb
gjp-0.34.0 spec/spec_helper.rb
gjp-0.33.0 spec/spec_helper.rb
gjp-0.32.0 spec/spec_helper.rb
gjp-0.31.0 spec/spec_helper.rb
gjp-0.30.0 spec/spec_helper.rb