Sha256: 0e58bbfcb13d48fba88ff0d0ab7266dc48dd5c09564a4de454f475024a8db5a5
Contents?: true
Size: 1.52 KB
Versions: 3
Compression:
Stored size: 1.52 KB
Contents
# frozen_string_literal: true require 'spec_helper' RSpec.describe ProxyPacLinter do subject(:proxy_pac) { instance_double('ProxyPac::ProxyPacFile') } let(:content) do <<-EOS.strip_heredoc.chomp function FindProxyForURL(url, host) { return "DIRECT"; } EOS end let(:source) do <<-EOS.strip_heredoc.chomp function FindProxyForURL(url, host) { return "DIRECT"; } EOS end before :each do allow(proxy_pac).to receive(:source).and_return(source) allow(proxy_pac).to receive(:content).and_return(content) allow(proxy_pac).to receive(:valid).and_return(true) allow(proxy_pac).to receive(:type?).with(:string).and_return(true) allow(proxy_pac).to receive(:readable?).and_return(true) end describe '#lint' do let(:linter) { ProxyPacLinter.new(silent: true) } let(:result) { true } before(:each) do expect(proxy_pac).to receive(:valid=).with(result) allow(proxy_pac).to receive(:message=) end context 'when is valid' do it { linter.lint(proxy_pac) } end context 'when is proxy.pac does not contain FindProxyForURL' do let(:result) { false } let(:content) { '' } it { linter.lint(proxy_pac) } end context 'when is proxy.pac cannot be compiled' do let(:result) { false } let(:content) do <<-EOS.strip_heredoc.chomp function FindProxyForURL(url, host) { asdfasf $$ SDF } EOS end it { linter.lint(proxy_pac) } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
proxy_pac_rb-2.1.0 | spec/api/proxy_pac_linter_spec.rb |
proxy_pac_rb-2.0.0 | spec/api/proxy_pac_linter_spec.rb |
proxy_pac_rb-1.0.0 | spec/api/proxy_pac_linter_spec.rb |