Sha256: 2a00315303f66b2295523fcfb8ed65d14a815e1900faa662812d80f9cd977c10

Contents?: true

Size: 1.56 KB

Versions: 38

Compression:

Stored size: 1.56 KB

Contents

require 'spec_helper'

describe "WebMock" do

  describe ".version" do
    it "should report version" do
      expect(WebMock.version).to eq(WebMock::VERSION)
    end

    it "should not require safe_yaml" do
      expect(defined?SafeYAML).to eq(nil)
    end

    it "should alias enable_net_connect! to allow_net_connect!" do
      expect(WebMock.method(:enable_net_connect!)).to eq(WebMock.method(:allow_net_connect!))
    end

    it "should alias disallow_net_connect! to disable_net_connect!" do
      expect(WebMock.method(:disallow_net_connect!)).to eq(WebMock.method(:disable_net_connect!))
    end
  end

  describe ".net_connect_allowed?" do
    context 'enabled globally' do
      before do
        WebMock.enable_net_connect!
      end

      context 'without arguments' do
        it 'returns WebMock::Config.instance.allow_net_connect' do
          expect(WebMock.net_connect_allowed?).to eql(true)
        end
      end
    end

    context 'disabled with allowed remote string' do
      before do
        WebMock.disable_net_connect!(allow: "http://192.168.64.2:20031")
      end

      context 'without arguments' do
        it 'returns WebMock::Config.instance.allow_net_connect' do
          expect(WebMock.net_connect_allowed?).to eql(false)
        end
      end
    end

    context 'disabled globally' do
      before do
        WebMock.disable_net_connect!
      end

      context 'without arguments' do
        it 'returns WebMock::Config.instance.allow_net_connect' do
          expect(WebMock.net_connect_allowed?).to eql(false)
        end
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 3 rubygems

Version Path
webmock-3.15.2 spec/unit/webmock_spec.rb
webmock-3.15.1 spec/unit/webmock_spec.rb
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb
webmock-3.14.0 spec/unit/webmock_spec.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb