Sha256: 676806e7e19ef67788fdf8a701b2a2ab8db286efd49d59bb40a1027ce7413467

Contents?: true

Size: 594 Bytes

Versions: 14

Compression:

Stored size: 594 Bytes

Contents

require 'rspec/webservice_matchers/util'

module RSpec
  module WebserviceMatchers
    module BeStatus
      # Pass when a URL returns the expected status code
      # Codes are defined in http://www.rfc-editor.org/rfc/rfc2616.txt
      RSpec::Matchers.define :be_status do |expected_code|
        actual_code = nil
        
        match do |url_or_domain_name|
          actual_code = Util.status(url_or_domain_name)
          actual_code == expected_code.to_i
        end
        
        failure_message do
          "Received status #{actual_code}"
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

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