# 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_true expect(path_exists?('config/config.yaml')).to be_true expect(path_exists?('test_cases.d')).to be_true expect(path_exists?('test_cases.d/examples/support')).to be_true expect(path_exists?('test_cases.d/examples/example_spec.rb')).to be_true expect(path_exists?('test_cases.d/examples/spec_helper.rb')).to be_true expect(result).to include('config_file:') end end end