Sha256: ce527ca0cf85808538e12109f59080568ecccdd38e1ecc2c35529193c651603c

Contents?: true

Size: 1.45 KB

Versions: 2

Compression:

Stored size: 1.45 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe Actions::InitializeApplication do
  context '#run' do
    it 'creates all files/directories neccessary to run local_pac' do
      config_string = <<-EOS.strip_heredoc
        :user_file: #{File.join(working_directory, 'config', 'user_file.csv')}
        :config_file: #{File.join(working_directory, 'config', 'config.yaml')}
        :test_cases_directory: #{File.join(working_directory, 'test_cases.d')}
        :examples_directory: #{File.join(working_directory, 'test_cases.d/examples')}
      EOS

      config_file = create_file('config_spec.yaml', config_string)

      config = ProxyTester::Config.new(config_file)

      initializer = Actions::InitializeApplication.new({
          create_user_file: true,
          create_config_file: true,
          create_test_cases_directory: true,
          pre_seed: true
      }, config)

      result = capture(:stdout) do
        silence(:stderr) do
          initializer.run
        end
      end

      expect(path_exists?('config/user_file.csv')).to be_truthy
      expect(path_exists?('config/config.yaml')).to be_truthy
      expect(path_exists?('test_cases.d')).to be_truthy
      expect(path_exists?('test_cases.d/examples/support')).to be_truthy
      expect(path_exists?('test_cases.d/examples/example_spec.rb')).to be_truthy
      expect(path_exists?('test_cases.d/examples/spec_helper.rb')).to be_truthy
      expect(result).to include('config_file:')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
proxy_tester-0.1.10 spec/actions/initialize_application_spec.rb
proxy_tester-0.1.8 spec/actions/initialize_application_spec.rb