Sha256: a901e8c6828addae4a201c35e2ba0e229cf66d7f75abebd9df5f9f091380497d

Contents?: true

Size: 1.42 KB

Versions: 1

Compression:

Stored size: 1.42 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe ApplicationStatus 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 {
        ApplicationStatus.new
      }.not_to raise_error
    end

    it 'let you deactivate paging' do
      expect {
        ApplicationStatus.new(pager: false)
      }.not_to raise_error
    end
  end

  context '#show' 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)
      pid_file = create_file('run/pid', $$)

      config = LocalPac::Config.new(config_file)

      result = capture(:stdout) do
        ApplicationStatus.new(pager: false, config: config).show
      end

      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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
local_pac-0.5.0 spec/application_status_spec.rb