Sha256: c063c98e819230137d91668536072e115b3b0e1eca13829c99b95b45c32b9f65

Contents?: true

Size: 860 Bytes

Versions: 5

Compression:

Stored size: 860 Bytes

Contents

# frozen_string_literal: true
require 'rspec/webservice_matchers/util'
require 'rspec/webservice_matchers/redirect_helpers'

module RSpec
  module WebserviceMatchers
    module RedirectPermanentlyTo
      RSpec::Matchers.define :redirect_permanently_to do |expected_location|
        include RedirectHelpers
        kind = :permanent
        status = actual_location = exception = nil

        match do |url_or_domain_name|
          begin
            status, actual_location = redirect_result(url_or_domain_name)
            redirects_correctly?(status, actual_location, expected_location, kind)
          rescue Faraday::ConnectionFailed => e
            exception = e
            false
          end
        end

        failure_message do
          redirect_failure_message(exception, status, actual_location, kind)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rspec-webservice_matchers-4.9.0 lib/rspec/webservice_matchers/redirect_permanently_to.rb
rspec-webservice_matchers-4.8.1 lib/rspec/webservice_matchers/redirect_permanently_to.rb
rspec-webservice_matchers-4.8.0 lib/rspec/webservice_matchers/redirect_permanently_to.rb
rspec-webservice_matchers-4.7.0 lib/rspec/webservice_matchers/redirect_permanently_to.rb
rspec-webservice_matchers-4.6.0 lib/rspec/webservice_matchers/redirect_permanently_to.rb