Sha256: 01c12f1106c4749952c74229b1a23d40de0d22ecc2ef058b39bf8518d0abb338
Contents?: true
Size: 1.45 KB
Versions: 26
Compression:
Stored size: 1.45 KB
Contents
require 'spec_helper' require 'proxy_pac_rb/rack/proxy_pac_linter' require 'rack/lint' RSpec.describe ProxyPacRb::Rack::ProxyPacLinter, type: :rack_test do let(:content) do <<-EOS.strip_heredoc.chomp function FindProxyForURL(url, host) { return "DIRECT"; } EOS end 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::ProxyPacLinter a.use Rack::Lint a.new end it { expect(body).to include content } end context 'when invalid proxy pac is given' do let(:content) { 'Unexpected 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::ProxyPacLinter a.use Rack::Lint a.new end it { expect(body).to include content } end end
Version data entries
26 entries across 26 versions & 1 rubygems