Sha256: 470f7bd198bc88073eb6ba08cf609904272a0e6feba25d51f201392e0f8e0edd
Contents?: true
Size: 1.45 KB
Versions: 5
Compression:
Stored size: 1.45 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(){return\"DIRECT\"}) } 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 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
5 entries across 5 versions & 1 rubygems