Sha256: c027f28f5c4abb67a8d612e558b318f2506d3fa63a4b79cf26312fd8d88ed5ae
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
require 'spec_helper' require 'proxy_pac_rb/rack/proxy_pac_linter' 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 ProxyPacRb::Rack::ProxyPacLinter 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 ProxyPacRb::Rack::ProxyPacLinter a.new end it { expect(body).to include content } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
proxy_pac_rb-0.4.0 | spec/rack/proxy_pac_linter_spec.rb |