Sha256: 790d678f2557af10f094805921f1f0edf3eb7e409111325554ea8be8d0166134

Contents?: true

Size: 850 Bytes

Versions: 1

Compression:

Stored size: 850 Bytes

Contents

require 'webmock/rspec'

RSpec.configure do |config|
  config.before(:each) do

    WebMock.stub_request :any, 'http://a-page.com/a/page.txt'
    WebMock.stub_request :any, 'www.website.com'
    WebMock.stub_request(:any, /notfound.com/).to_return(status: 404)
    WebMock.stub_request(:any, 'outoforder.com').to_return(status: 503)

    WebMock.stub_request(:any, 'perm-redirector.com')
      .to_return(status: 301, headers: {Location: 'http://www.website.com/'})

    WebMock.allow_net_connect!
  end
end


module RSpec
  module Matchers
    def fail
      raise_error(RSpec::Expectations::ExpectationNotMetError)
    end

    def fail_with(message)
      raise_error(RSpec::Expectations::ExpectationNotMetError, message)
    end

    def fail_matching(regex)
      raise_error(RSpec::Expectations::ExpectationNotMetError, regex)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-webservice_matchers-1.4.1 spec/spec_helper.rb