Sha256: 3d4b3a161c211accc6d7d59d8917c7fbd27821d65c22f5d5c7462f9f61ce7981

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'
require 'rspec/webservice_matchers'


describe 'be_status' do
  it 'can check 200 for successful resource requests' do
    'http://a-page.com/a/page.txt'.should be_status 200
  end

  it 'handles domain names as well as URLs' do
    'www.website.com'.should be_status 200
  end

  it 'accepts status code in text form too' do
    'www.website.com'.should be_status '200'
  end

  it 'can check for the 503 - Service Unavailable status' do
    'http://outoforder.com/'.should be_status 503
  end

  it 'can check for 404' do
    expect('http://notfound.com/no.txt').to be_status 404
  end

  it 'gives the actual code received in case of failure' do
    expect {
      expect('http://notfound.com/no.txt').to be_status 200
    }.to fail_matching(/404/)
  end
end


describe 'be_up' do
  it 'follows redirects when necessary' do
    'perm-redirector.com'.should be_up
  end

  it 'can also handle a simple 200' do
    'http://www.website.com/'.should be_up
  end

  it 'is available via a public API' do
    RSpec::WebserviceMatchers.up?('http://www.website.com/').should be true
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-webservice_matchers-1.4.1 spec/rspec/webservice_matchers/protcol_spec.rb