Sha256: 2f38ba7d9b9cb6331ae24f40644facdac1630e85bc61e4835f22941990d93b69

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

require "codeclimate-test-reporter"
CodeClimate::TestReporter.start

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

1 entries across 1 versions & 1 rubygems

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