Sha256: a147f9d6823412f967dc24ad1329fd87f68b991102d83001e7504cdbf79de23e

Contents?: true

Size: 1023 Bytes

Versions: 2

Compression:

Stored size: 1023 Bytes

Contents

require 'webmock/rspec'
require 'rspec/webservice_matchers'

#
# TODO: set up mocks or VCR for the rest of these.
# SEE:  http://www.slideshare.net/kjbuckley/testing-http-calls-with-webmock-and-vcr
#

WebMock.stub_request :any, 'http://www.website.com/a/page.txt'
WebMock.stub_request :any, 'http://www.website.com/'

WebMock.allow_net_connect!


describe 'status_code' do
  it 'can check 200 for successful resource requests' do
    'http://www.website.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 'can check 503 for the Service Unavailable status' do
    'http://www.weblaws.org/texas/laws/tex._spec._dist._local_laws_code_section_1011.202_tax_to_pay_general_obligation_bonds'.should be_status 503
  end
end


describe 'be_up' do
  it 'follows redirects when necessary' do
    'weblaws.org'.should be_up
  end

  it 'can also handle a simple 200' do
    'http://www.rfc-editor.org/rfc/rfc2616.txt'.should be_up
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-webservice_matchers-1.2.1 spec/rspec/webservice_matchers/protcol_spec.rb
rspec-webservice_matchers-1.2.0 spec/rspec/webservice_matchers/protcol_spec.rb