Sha256: a3103b5848bca24ebc07dc236924ab286e64145fa5e42f15e927a3b7c9e3b2a6
Contents?: true
Size: 1.5 KB
Versions: 2
Compression:
Stored size: 1.5 KB
Contents
require 'spec_helper' RSpec.describe ProxyPacDumper 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(:content).and_return(content) allow(proxy_pac).to receive(:source).and_return(source) end let(:dumper) { ProxyPacDumper.new } let(:destination) { absolute_path('proxy.pac') } describe '#dump' do before :each do allow(proxy_pac).to receive(:source).and_return(source) end context 'when proxy pac is string' do before :each do in_current_dir do dumper.dump(proxy_pac, type: :string) end end it { expect(destination).to be_existing_file } it { expect(destination).to have_content proxy_pac.content } end context 'when proxy pac is file' do let(:source) { 'proxy.pac.in' } before :each do write_file(source, content) end before :each do in_current_dir do dumper.dump(proxy_pac, type: :template) end end around :example do |example| in_current_dir { example.call } end it { expect(destination).to be_existing_file } it { expect(destination).to have_content proxy_pac.content } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
proxy_pac_rb-0.5.1 | spec/api/proxy_pac_dumper_spec.rb |
proxy_pac_rb-0.5.0 | spec/api/proxy_pac_dumper_spec.rb |