Sha256: 7e8b001bb6ec2ccc783ed8987d6f51d7dd0cc06942906fa011ad2cc3c93c3a79

Contents?: true

Size: 1.1 KB

Versions: 5

Compression:

Stored size: 1.1 KB

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.stub_request(:any, 'temp-redirector.org')
      .to_return(status: 302, headers: {Location: 'http://a-page.com/a/page.txt'})

    WebMock.stub_request(:any, 'temp-307-redirector.net')
      .to_return(status: 307, headers: {Location: 'http://a-page.com/a/page.txt'})

    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

5 entries across 5 versions & 1 rubygems

Version Path
rspec-webservice_matchers-1.4.6 spec/spec_helper.rb
rspec-webservice_matchers-1.4.5 spec/spec_helper.rb
rspec-webservice_matchers-1.4.4 spec/spec_helper.rb
rspec-webservice_matchers-1.4.3 spec/spec_helper.rb
rspec-webservice_matchers-1.4.2 spec/spec_helper.rb