Sha256: 88c1d5187ba9b504423954e8b5a2918ad3e4828b84b4733963cd7949898d4038
Contents?: true
Size: 1.52 KB
Versions: 5
Compression:
Stored size: 1.52 KB
Contents
require File.dirname(__FILE__) + '/spec_helper' module Anemone describe Page do before(:all) do @http = Anemone::HTTP.new end before(:each) do @page = @http.fetch_page(FakePage.new('home').url) end it "should store the response headers when fetching a page" do @page.headers.should_not be_nil @page.headers.should have_key('content-type') end it "should have an OpenStruct attribute for the developer to store data in" do @page.data.should_not be_nil @page.data.should be_an_instance_of(OpenStruct) @page.data.test = 'test' @page.data.test.should == 'test' end it "should have a Nokogori::HTML::Document attribute for the page body" do @page.doc.should_not be_nil @page.doc.should be_an_instance_of(Nokogiri::HTML::Document) end it "should indicate whether it was fetched after an HTTP redirect" do @page.should respond_to(:redirect?) @page.redirect?.should == false @http.fetch_page(FakePage.new('redir', :redirect => 'home').url).redirect?.should == true end it "should have a method to tell if a URI is in the same domain as the page" do @page.should respond_to(:in_domain?) @page.in_domain?(URI(FakePage.new('test').url)).should == true @page.in_domain?(URI('http://www.other.com/')).should == false end it "should include the response time for the HTTP request" do @page.should respond_to(:response_time) end end end
Version data entries
5 entries across 5 versions & 3 rubygems
Version | Path |
---|---|
spk-anemone-0.2.4 | spec/page_spec.rb |
shingara-anemone-0.2.4 | spec/page_spec.rb |
anemone-0.2.3 | spec/page_spec.rb |
anemone-0.2.2 | spec/page_spec.rb |
anemone-0.2.1 | spec/page_spec.rb |