spec/search/web_query_spec.rb in gscraper-0.3.0 vs spec/search/web_query_spec.rb in gscraper-0.4.0
- old
+ new
@@ -9,11 +9,13 @@
describe GScraper::Search::WebQuery do
include Helpers
before(:all) do
- @query = GScraper::Search::WebQuery.new(:query => Helpers::DEFAULT_QUERY)
+ @query = GScraper::Search::WebQuery.new(
+ :query => Helpers::DEFAULT_QUERY
+ )
@page = @query.first_page
@links = @query.sponsored_links
end
it_should_behave_like "has Pages"
@@ -26,9 +28,27 @@
@uri = @query.search_url
end
it "should be a valid HTTP URI" do
@uri.class.should == URI::HTTP
+ end
+
+ it "should have a default host of www.google.com" do
+ @uri.host.should == 'www.google.com'
+ end
+
+ it "should allow using alternate hosts" do
+ other_host = 'www.google.com.ar'
+ other_query = GScraper::Search::WebQuery.new(
+ :search_host => other_host,
+ :query => Helpers::DEFAULT_QUERY
+ )
+
+ other_query.search_url.host.should == other_host
+ end
+
+ it "should have a path of /search" do
+ @uri.path.should == '/search'
end
it "should have a 'q' query-param" do
@uri.query_params['q'].should == Helpers::DEFAULT_QUERY
end