Sha256: 81c850757a47ea8a9d9711cf4c6e3b251177724cc3da75fef3fa9af4e6e9dbc4
Contents?: true
Size: 1.52 KB
Versions: 3
Compression:
Stored size: 1.52 KB
Contents
# frozen_string_literal: true 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(url, host) {\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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
proxy_pac_rb-2.1.0 | spec/rack/proxy_pac_compressor_spec.rb |
proxy_pac_rb-2.0.0 | spec/rack/proxy_pac_compressor_spec.rb |
proxy_pac_rb-1.0.0 | spec/rack/proxy_pac_compressor_spec.rb |