Sha256: 4c772b00f1b8b1bdc01acd7826082b7b2a79201f11513591d54c292ec8910faf
Contents?: true
Size: 1.53 KB
Versions: 3
Compression:
Stored size: 1.53 KB
Contents
# frozen_string_literal: true require 'spec_helper' RSpec.describe ProxyPacDumper, type: :aruba 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) { expand_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 cd('.') 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 cd('.') do dumper.dump(proxy_pac, type: :template) end end around :example do |example| cd('.') { 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
proxy_pac_rb-2.1.0 | spec/api/proxy_pac_dumper_spec.rb |
proxy_pac_rb-2.0.0 | spec/api/proxy_pac_dumper_spec.rb |
proxy_pac_rb-1.0.0 | spec/api/proxy_pac_dumper_spec.rb |