Sha256: cf4aa691393e1a70352d260d35cf97e0ace7f5142e38da2e204a8375d0dea2c8
Contents?: true
Size: 1.47 KB
Versions: 8
Compression:
Stored size: 1.47 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Actions::ValidatePacFile do let(:valid_pac_file) do <<-EOS.strip_heredoc.chomp function FindProxyForURL(url, host) { return "DIRECT"; } EOS end let(:invalid_pac_file) do <<-EOS.strip_heredoc.chomp function FindProxyForURL(url, host) { aasdf(); } EOS end context '#initialize' do it 'requires a file' do file = create_file 'pac_file', valid_pac_file expect { Actions::ValidatePacFile.new(file) }.not_to raise_error end end context '#run' do it 'outputs an info if pac file is valid' do file = create_file 'pac_file', valid_pac_file action = Actions::ValidatePacFile.new(file) result = capture(:stdout) do action.run end expect(result).to include('is a valid pac file') end it 'outputs an warning if pac file is invalid' do file = create_file 'pac_file', invalid_pac_file action = Actions::ValidatePacFile.new(file) result = capture(:stdout) do action.run end expect(result).to include('is not a valid pac file') end it 'raises an error if path is not a file' do action = Actions::ValidatePacFile.new(working_directory) expect { action.run }.to raise_error Exceptions::PacFileInvalid end end end
Version data entries
8 entries across 8 versions & 1 rubygems