Sha256: 79d3e33aa036727424410bc972b133408a7978dee92a37d8c006b39ce8c6ae98
Contents?: true
Size: 1.09 KB
Versions: 4
Compression:
Stored size: 1.09 KB
Contents
require 'epitools/browser' #describe Browser do # # before :all do # @browser = Browser.new # end # # after :all do # @browser.cache.delete! # end # # it "googles" do # page = @browser.get("http://google.com") # page.body["Feeling Lucky"].should_not be_empty # end # #end class Mechanize::Page def url uri.to_s end end describe CacheDB do before :all do @agent = Mechanize.new CacheDB.new(@agent).delete! @cache = CacheDB.new(@agent) end def new_page(body, url) Mechanize::Page.new( URI.parse(url), {'content-type'=>'text/html'}, body, nil, @agent ) end after :all do #@cache.delete! end it "writes and reads" do body = "Blah blah blah." url = "http://example.com/url.html" page = new_page(body, url) page.body.should == body page.url.should == url @cache.put page, url p @cache.urls @cache.includes?(url).should == true result = @cache.get url body.should == page.body body.should == result.body url.should == page.url url.should == result.url end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
epitools-0.4.5 | spec/browser_spec.rb |
epitools-0.4.2 | spec/browser_spec.rb |
epitools-0.4.1 | spec/browser_spec.rb |
epitools-0.4.0 | spec/browser_spec.rb |