spec/search/query_spec.rb in gscraper-0.3.0 vs spec/search/query_spec.rb in gscraper-0.4.0

- old
+ new

@@ -1,9 +1,38 @@ require 'spec_helper' require 'gscraper/search/query' describe GScraper::Search::Query do + it "should have a default host of www.google.com" do + query = GScraper::Search::Query.new + + query.search_host.should == 'www.google.com' + end + + it "should allow using alternate hosts" do + alternate_host = 'www.google.com.ar' + query = GScraper::Search::Query.new( + :search_host => alternate_host + ) + + query.search_host.should == alternate_host + end + + it "should use random hosts if load balancing is enabled" do + query = GScraper::Search::Query.new(:load_balance => true) + + host1 = query.search_host + host2 = query.search_host + + host1.should_not == host2 + end + + it "should have a default language" do + query = GScraper::Search::Query.new + + query.language.should_not be_nil + end it "should support basic queries" do expr = 'ruby -blog' query = GScraper::Search::Query.new(:query => expr) query.expression.should == expr