Sha256: 74caed1c5f4ccda8073c5b51cbdfe304ed6825cefa8e5c52419f6b6df335bd4a
Contents?: true
Size: 1.49 KB
Versions: 20
Compression:
Stored size: 1.49 KB
Contents
require 'spec_helper' require 'proxy_pac_rb/rack/proxy_pac_compressor' require 'rack/lint' RSpec.describe ProxyPacRb::Rack::ProxyPacCompressor, type: :rack_test do let(:compressed_content) { %(function FindProxyForURL() {\n return \"DIRECT\";\n}) } before(:each) { get '/' } subject(:body) { last_response.body } context 'when valid proxy pac is given' do let(:app) do a = Class.new(Sinatra::Base) do before do content_type 'application/x-ns-proxy-autoconfig' end get '/' do <<-EOS.strip_heredoc.chomp // comment function FindProxyForURL(url, host) { return "DIRECT"; } EOS end end a.use Rack::Lint a.use ProxyPacRb::Rack::ProxyPacCompressor a.use Rack::Lint a.new end it { expect(body).to eq compressed_content } end context 'when invalid proxy pac is given' do let(:compressed_content) { %{Unexpected token: string (§$ )} } let(:app) do a = Class.new(Sinatra::Base) do before do content_type 'application/x-ns-proxy-autoconfig' end get '/' do <<-EOS.strip_heredoc.chomp function FindProxyForURL(url, host) { return $"§$ "DIRECT"; } EOS end end a.use Rack::Lint a.use ProxyPacRb::Rack::ProxyPacCompressor a.use Rack::Lint a.new end it { expect(body).to include compressed_content } end end
Version data entries
20 entries across 20 versions & 1 rubygems