Sha256: e40c415d0156532365ee0e8e00673c32c29722aa8b1df1ed70386c6e43a1ca58
Contents?: true
Size: 1.49 KB
Versions: 1
Compression:
Stored size: 1.49 KB
Contents
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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
proxy_pac_rb-0.9.1 | spec/api/proxy_pac_linter_spec.rb |