Sha256: 86f1cd85e1eedb1caf89d7d0347250b9ec280b128176ce65740d70c1a03eb287

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

require 'pathname'

module FileWorld
  def bin_path
    File.expand_path(File.join(File.dirname(__FILE__),
                               "..",
                               ".."))
  end

  def git_project_path
    f = File.expand_path(File.join(File.dirname(__FILE__),
                                 "..",
                                 "..",
                                 "spec",
                                 "fixtures",
                                 "with_git"))
    Pathname.new(f)
  end

  def hooks_path(type)
    path = git_project_path.join(".git",
                                 "hooks",
                                 type)
    path
  end

  def hook_config_file_path
    git_project_path.join('hoogfile.yml')
  end

  def write_file(path, file_content)
    File.open(path, 'w') { |file| file.write(file_content) }
  end

  def write_spec(name, file_content)
    spec_name = File.expand_path(File.join(File.dirname(__FILE__),
                          '..',
                          '..',
                          'spec',
                          'hooks',
                          "#{name}.rb"))
    write_file(spec_name, file_content)
  end
  
end

World(FileWorld)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
captain_hoog-1.1.1 features/support/world.rb
captain_hoog-1.1.0 features/support/world.rb