Sha256: 9a667448851631048da5111f9ca4b45cd27d43c63eaf60618bea250b57eae688

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require_relative "./helpers"

describe TestWebServer do
  
  it "should respond to mock GET requests" do    
    uri = URI('http://localhost:3001/')
    Net::HTTP.start(uri.host, uri.port) do |http|
      request = Net::HTTP::Get.new(uri.request_uri)
      last_response = http.request(request)
      last_response.code.should == '200'
      last_response.body.should == 'Test'
    end
  end
  
  it "should respond to mock POST requests" do
    uri = URI('http://localhost:3001/')
    Net::HTTP.start(uri.host, uri.port) do |http|
      request = Net::HTTP::Post.new(uri.request_uri)
      last_response = http.request(request)
      last_response.code.should == '200'
      last_response.body.should == 'Test'
    end
  end
  
  it "should respond to mock PUT requests" do
    uri = URI('http://localhost:3001/')
    Net::HTTP.start(uri.host, uri.port) do |http|
      request = Net::HTTP::Put.new(uri.request_uri)
      last_response = http.request(request)
      last_response.code.should == '200'
      last_response.body.should == 'Test'
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bigbench-0.0.1 spec/webserver_spec.rb