# encoding: utf-8 require 'spec_helper' describe Initializer do context '#run' do it 'creates all files/directories neccessary to run local_pac' do config_string = <<-EOS.strip_heredoc :log_sink: #{File.join(working_directory, 'log')} :local_storage: #{File.join(working_directory, 'storage', 'cache.git')} :executable: #{File.join(working_directory, 'bin', 'local_pac')} :pid_file: #{File.join(working_directory, 'run', 'pid')} :gem_path: [] EOS config_file = create_file('config.yaml', config_string) config = LocalPac::Config.new({}, config_file) initializer = Initializer.new(config) silence(:stderr) do initializer.run end expect(path_exists?('log')).to be_true expect(path_exists?('storage/cache.git')).to be_true expect(path_exists?(File.join('storage', 'cache.git', 'hooks', 'pre-receive'))).to be_true expect(path_exists?('run')).to be_true end end end