Sha256: b7c26ec1567f133fe3759e5e9b83a36fe68788dcd86d779f0d148edef3fa70a6

Contents?: true

Size: 844 Bytes

Versions: 6

Compression:

Stored size: 844 Bytes

Contents

# frozen_string_literal: true
require 'web_test/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

6 entries across 6 versions & 1 rubygems

Version Path
rspec-webservice_matchers-4.13 lib/rspec/webservice_matchers/redirect_permanently_to.rb
rspec-webservice_matchers-4.12.2 lib/rspec/webservice_matchers/redirect_permanently_to.rb
rspec-webservice_matchers-4.12.1 lib/rspec/webservice_matchers/redirect_permanently_to.rb
rspec-webservice_matchers-4.12.0 lib/rspec/webservice_matchers/redirect_permanently_to.rb
rspec-webservice_matchers-4.11.0 lib/rspec/webservice_matchers/redirect_permanently_to.rb
rspec-webservice_matchers-4.10.0 lib/rspec/webservice_matchers/redirect_permanently_to.rb