<commit_before>require 'spec_helper'
require 'skyed'
require 'highline/import'

describe 'Skyed::Init.execute' do
  let(:repository) { double('repository') }
  let(:repo_path)  { double('repo_path') }
  let(:path)       { 'path' }
  before(:each) do
    allow(Skyed::Init)
      .to receive(:repo_path)
      .and_return(repo_path)
    allow(Skyed::Init)
      .to receive(:get_repo)
      .and_return(repository)
    allow(repo_path)
      .to receive(:to_s)
      .and_return(path)
    allow(Skyed::Init)
      .to receive(:branch)
      .and_return('devel-1')
    allow(Skyed::Init)
      .to receive(:credentials)
      .and_return(%w( 'a', 'a' ))
    allow(File)
      .to receive(:exist?)
      .and_return(true)
    allow(Skyed::Settings)
      .to receive(:save)
    allow(Skyed::Settings)
      .to receive(:empty?)
      .and_return(true)
  end
  it 'initializes skyed' do
    Skyed::Init.execute(nil)
  end
  it 'fails when already initialized' do
    allow(Skyed::Settings)
      .to receive(:empty?)
      .and_return(false)
    expect { Skyed::Init.execute(nil) }
      .to raise_error
  end
end

describe 'Skyed::Init.vagrant' do
  let(:repo_path)          { '/tmp/path' }
  let(:vagrantfile_erb)    { double('ERB') }
  let(:vagrantfile_handle) { double('File') }
  let :provisioning_path do
    File.join(
      repo_path,
      '.provisioning')
  end
  let(:templates_path) do
    File.join(
      provisioning_path,
      'templates',
      'aws')
  end
  let(:tasks_path) do
    File.join(
      provisioning_path,
      'tasks')
  end
  before(:each) do
    allow(Skyed::Init)
      .to receive(:`)
      .with('pip install ansible')
    allow(Skyed::Settings)
      .to receive(:repo)
      .and_return(repo_path)
    allow(FileUtils)
      .to receive(:mkdir_p)
      .with(templates_path)
    allow(FileUtils)
      .to receive(:mkdir_p)
      .with(tasks_path)<commit_msg>Fixes backtick mocking for Skyed::Init.vagrant<commit_after>require 'spec_helper'
require 'skyed'
require 'highline/import'

describe 'Skyed::Init.execute' do
  let(:repository) { double('repository') }
  let(:repo_path)  { double('repo_path') }
  let(:path)       { 'path' }
  before(:each) do
    allow(Skyed::Init)
      .to receive(:repo_path)
      .and_return(repo_path)
    allow(Skyed::Init)
      .to receive(:get_repo)
      .and_return(repository)
    allow(repo_path)
      .to receive(:to_s)
      .and_return(path)
    allow(Skyed::Init)
      .to receive(:branch)
      .and_return('devel-1')
    allow(Skyed::Init)
      .to receive(:credentials)
      .and_return(%w( 'a', 'a' ))
    allow(File)
      .to receive(:exist?)
      .and_return(true)
    allow(Skyed::Settings)
      .to receive(:save)
    allow(Skyed::Settings)
      .to receive(:empty?)
      .and_return(true)
  end
  it 'initializes skyed' do
    Skyed::Init.execute(nil)
  end
  it 'fails when already initialized' do
    allow(Skyed::Settings)
      .to receive(:empty?)
      .and_return(false)
    expect { Skyed::Init.execute(nil) }
      .to raise_error
  end
end

describe 'Skyed::Init.vagrant' do
  let(:repo_path)          { '/tmp/path' }
  let(:vagrantfile_erb)    { double('ERB') }
  let(:vagrantfile_handle) { double('File') }
  let :provisioning_path do
    File.join(
      repo_path,
      '.provisioning')
  end
  let(:templates_path) do
    File.join(
      provisioning_path,
      'templates',
      'aws')
  end
  let(:tasks_path) do
    File.join(
      provisioning_path,
      'tasks')
  end
  before(:each) do
    allow(Skyed::Init)
      .to receive(:`)
    allow(Skyed::Settings)
      .to receive(:repo)
      .and_return(repo_path)
    allow(FileUtils)
      .to receive(:mkdir_p)
      .with(templates_path)
    allow(FileUtils)
      .to receive(:mkdir_p)
      .with(tasks_path)
{'fraction_non_alphanumeric': 0.14353562005277046, 'fraction_numerical': 0.0005277044854881266, 'mean_word_length': 2.783433133732535, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4287635', 'n_tokens_mistral': 1374, 'n_tokens_neox': 1344, 'n_words': 244}