Sha256: a102104018d4178f7884f898af6d1412a9e3a8ec67253c86cf968c518078ba14

Contents?: true

Size: 554 Bytes

Versions: 6

Compression:

Stored size: 554 Bytes

Contents

# frozen_string_literal: true
require 'rspec/matchers'
require 'web_test/be_up'

# Pass when the response code is 200, following redirects if necessary.
module RSpec
  module WebserviceMatchers
    module BeUp
      RSpec::Matchers.define :be_up do
        status = nil

        match do |url_or_domain_name|
          result = WebTest::BeUp.test(url: url_or_domain_name)
          status = result.status_code
          result.success?
        end

        failure_message do
          "Received status #{status}"
        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/be_up.rb
rspec-webservice_matchers-4.12.2 lib/rspec/webservice_matchers/be_up.rb
rspec-webservice_matchers-4.12.1 lib/rspec/webservice_matchers/be_up.rb
rspec-webservice_matchers-4.12.0 lib/rspec/webservice_matchers/be_up.rb
rspec-webservice_matchers-4.11.0 lib/rspec/webservice_matchers/be_up.rb
rspec-webservice_matchers-4.10.0 lib/rspec/webservice_matchers/be_up.rb