# encoding: utf-8 require 'spec_helper' describe Actions::ShowApplicationStatus do let(:valid_pac_file) do <<-EOS.strip_heredoc.chomp function FindProxyForURL(url, host) { return "DIRECT"; } EOS end context '#initialize' do it 'has no special requirements' do expect { Actions::ShowApplicationStatus.new }.not_to raise_error end it 'let you deactivate paging' do expect { Actions::ShowApplicationStatus.new(pager: false) }.not_to raise_error end end context '#run' do it 'show application status' do git_repo = ::File.join(working_directory, 'data', 'storage.git') repo = GitRepository.create(git_repo) repo.add_content('proxy.pac', valid_pac_file) config_string = <<-EOS.strip_heredoc :pid_file: #{::File.join(working_directory, 'run', 'pid')} :local_storage: #{git_repo} EOS config_file = create_file('config.yaml', config_string) create_file('run/pid', $$) config = LocalPac::Config.new(config_file) result = capture(:stdout) do Actions::ShowApplicationStatus.new(pager: false, config: config).run end # timing problems #expect(result).to include('osfamily') expect(result).to include('pid_file') expect(result).to include('pid_file') expect(result).to include('cmdline') expect(result).to include('proxy.pac') end end end