Sha256: 05032c4c3c86e3829972791d8835cb0fa82dcce360c32212a0ccfb99c59f7993
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
require 'spec_helper' describe PacFileValidator do context '#valid?' do let(:valid_pac_file) do <<-EOS.strip_heredoc function FindProxyForURL(url, host) { return "DIRECT" } EOS end let(:invalid_pac_file1) do <<-EOS.strip_heredoc function FindProxyForURL(url, host) { EOS end let(:invalid_pac_file2) do <<-EOS.strip_heredoc function FindProxyForURL(url, host) { asdf(); } EOS end it 'returns true if file is valid' do file = double('PacFile') expect(file).to receive(:content).and_return(valid_pac_file) validator = PacFileValidator.new expect(validator.valid?(file)).to be_true end it 'returns false if file produces parsing error' do file = double('PacFile') expect(file).to receive(:content).and_return(invalid_pac_file1) validator = PacFileValidator.new expect(validator.valid?(file)).to be_false end it 'returns false if file uses invalid function' do file = double('PacFile') expect(file).to receive(:content).and_return(invalid_pac_file2) validator = PacFileValidator.new expect(validator.valid?(file)).to be_false end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
local_pac-0.5.0 | spec/pac_file_validator_spec.rb |
local_pac-0.4.0 | spec/pac_file_validator_spec.rb |