Sha256: 222a3b83567e7bf7cc6a163ce684f3fe23a5eea0d7210d6f9b9142866ebd8c87

Contents?: true

Size: 1.36 KB

Versions: 15

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'
require 'proxy_pac_rb/rspec'

RSpec.describe 'Validity', type: :proxy_pac do
  subject do
    <<-EOS.strip_heredoc.chomp
      function FindProxyForURL(url, host) {
        return "DIRECT";
      }
    EOS
  end

  context 'when is valid' do
    it { expect(proxy_pac).to be_valid }

    context 'although it makes URI to raise invalid url error' do
      subject do
        <<-EOS.strip_heredoc.chomp
        function FindProxyForURL(url, host) {
          // comment
          if ( dnsDomainIs ( host, "example.org") ) {
            return "PROXY 10.0.0.0:8080";
          }
        }
        EOS
      end

      it { expect(proxy_pac).to be_valid }
    end
  end

  context 'when is not valid' do
    context 'when is not readable' do
      subject { 'function Gargabe' }

      it { expect(proxy_pac).not_to be_valid }
    end

    context 'when contains gargabe' do
      subject do
        <<-EOS.strip_heredoc.chomp
        function FindProxyForURL(url, host) {
          return $ยง"% "DIRECT";
        }
        EOS
      end

      it { expect(proxy_pac).not_to be_valid }
    end

    context 'when undefined variable is referenced' do
      subject do
        <<-EOS.strip_heredoc.chomp
        function FindProxyForURL(url, host) {
          return asdf;
        }
        EOS
      end

      it { expect(proxy_pac).not_to be_valid }
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
proxy_pac_rb-0.9.1 spec/rspec/validitiy_spec.rb
proxy_pac_rb-0.8.2 spec/rspec/validitiy_spec.rb
proxy_pac_rb-0.8.1 spec/rspec/validitiy_spec.rb
proxy_pac_rb-0.8.0 spec/rspec/validitiy_spec.rb
proxy_pac_rb-0.7.0 spec/rspec/validitiy_spec.rb
proxy_pac_rb-0.6.9 spec/rspec/validitiy_spec.rb
proxy_pac_rb-0.6.8 spec/rspec/validitiy_spec.rb
proxy_pac_rb-0.6.7 spec/rspec/validitiy_spec.rb
proxy_pac_rb-0.6.5 spec/rspec/validitiy_spec.rb
proxy_pac_rb-0.6.4 spec/rspec/validitiy_spec.rb
proxy_pac_rb-0.6.3 spec/rspec/validitiy_spec.rb
proxy_pac_rb-0.6.2 spec/rspec/validitiy_spec.rb
proxy_pac_rb-0.6.1 spec/rspec/validitiy_spec.rb
proxy_pac_rb-0.6.0 spec/rspec/validitiy_spec.rb
proxy_pac_rb-0.5.10 spec/rspec/validitiy_spec.rb