Sha256: dc8974d46b2d2470fc279acf865f38dff9e4d6bde8fdc654a3801c68f7ff40f3
Contents?: true
Size: 1.25 KB
Versions: 3
Compression:
Stored size: 1.25 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') shared_examples_for "all requests" do it "should work" do @resp.should be_success end it "should have a response of the correct class" do @resp.response.should be_a(@resp_class) end it "shoudl have all attribures" do @resp.time.should be_a(Float) @resp.code.should be_a(Integer) @resp.url.should be_a(String) end end shared_examples_for "all builds" do before do @url = URL.new('http://www.omgpop.com') end describe "#get" do before do @resp = @url.get end it_should_behave_like "all requests" end describe "#post" do before do @resp = @url.post end it_should_behave_like "all requests" end describe "#delete" do before do @resp = @url.delete end it_should_behave_like "all requests" end end describe "Typhoeus", URL do before(:all) do require 'typhoeus' URL.req_handler = URL::TyHandler @resp_class = Typhoeus::Response end it_should_behave_like "all builds" end describe "Net::HTTP", URL do before(:all) do require 'net/http' URL.req_handler = URL::NetHandler @resp_class = Net::HTTPResponse end it_should_behave_like "all builds" end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
url-0.2.2 | spec/handler_spec.rb |
url-0.2.1 | spec/handler_spec.rb |
url-0.2.0 | spec/handler_spec.rb |