Sha256: 40309922416d04b8a173e9b859f014412936dbf41d10f4bccc84fb25120dd84b

Contents?: true

Size: 830 Bytes

Versions: 13

Compression:

Stored size: 830 Bytes

Contents

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

13 entries across 13 versions & 1 rubygems

Version Path
rspec-webservice_matchers-4.5.0 lib/rspec/webservice_matchers/redirect_permanently_to.rb
rspec-webservice_matchers-4.4.3 lib/rspec/webservice_matchers/redirect_permanently_to.rb
rspec-webservice_matchers-4.4.2 lib/rspec/webservice_matchers/redirect_permanently_to.rb
rspec-webservice_matchers-4.4.1 lib/rspec/webservice_matchers/redirect_permanently_to.rb
rspec-webservice_matchers-4.4.0 lib/rspec/webservice_matchers/redirect_permanently_to.rb
rspec-webservice_matchers-4.3.2 lib/rspec/webservice_matchers/redirect_permanently_to.rb
rspec-webservice_matchers-4.3.1 lib/rspec/webservice_matchers/redirect_permanently_to.rb
rspec-webservice_matchers-4.3.0 lib/rspec/webservice_matchers/redirect_permanently_to.rb
rspec-webservice_matchers-4.2.0 lib/rspec/webservice_matchers/redirect_permanently_to.rb
rspec-webservice_matchers-4.1.3 lib/rspec/webservice_matchers/redirect_permanently_to.rb
rspec-webservice_matchers-4.1.2 lib/rspec/webservice_matchers/redirect_permanently_to.rb
rspec-webservice_matchers-4.1.1 lib/rspec/webservice_matchers/redirect_permanently_to.rb
rspec-webservice_matchers-4.1.0 lib/rspec/webservice_matchers/redirect_permanently_to.rb