Sha256: 3a889565359dca9bc99805cfbd7692b493ab96c531d1e5d0e8bf066074aef92d
Contents?: true
Size: 933 Bytes
Versions: 4
Compression:
Stored size: 933 Bytes
Contents
require 'spec_helper' describe Fetcher do before do extend Fetcher end it "hpricots the fetched html" do stub!(:fetch_html).with("url").and_return("html") Hpricot.should_receive(:parse).with("html").and_return("doc") fetch_doc("url").should == "doc" end it "fetch_requests a url" do curb = mock("curb") curb.stub!(:body_str).and_return("uhh") should_receive(:fetch_request).with("url").and_return(curb) fetch_html("url").should == "uhh" end it "creates a new request" do req = mock("req") req.stub!(:follow_location=) req.stub!(:perform) Curl::Easy.should_receive(:new).with("url").and_return(req) fetch_request("url").should == req end it "follows redirects for fetched requests" do req = mock("req") req.should_receive(:follow_location=) req.should_receive(:perform) Curl::Easy.stub!(:new).and_return(req) fetch_request("url") end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
crags-2.1.2 | spec/crags/fetcher_spec.rb |
crags-2.1.1 | spec/crags/fetcher_spec.rb |
crags-2.1.0 | spec/crags/fetcher_spec.rb |
crags-2.0.0 | spec/crags/fetcher_spec.rb |