spec/search_spec.rb in handcrafted-twitter-0.4.0 vs spec/search_spec.rb in handcrafted-twitter-0.4.2
- old
+ new
@@ -47,10 +47,14 @@
it "should be able to specify the number of results per page" do
@search.per_page(25).query[:rpp].should == 25
end
+ it "should be able to specify the page number" do
+ @search.page(20).query[:page].should == 20
+ end
+
it "should be able to specify only returning results greater than an id" do
@search.since(1234).query[:since_id].should == 1234
end
it "should be able to specify geo coordinates" do
@@ -71,16 +75,23 @@
@search.query[:geocode].should == '40.757929,-73.985506,25mi'
end
describe "fetching" do
before do
- @response = open(File.dirname(__FILE__) + '/fixtures/friends_timeline.xml').read
+ @response = YAML.load_file(File.dirname(__FILE__) + '/fixtures/search_result_info.yml')
@search.class.stub!(:get).and_return(@response)
end
it "should return results" do
@search.class.should_receive(:get).and_return(@response)
@search.from('jnunemaker').fetch().should == @response
+ end
+
+ it "should support dot notation" do
+ @search.class.should_receive(:get).and_return(@response)
+ info = @search.from('httparty').fetch()
+ info["max_id"].should == info.max_id
+ info["results"].first["text"].should == info.results.first.text
end
end
it "should be able to iterate over results" do
@search.respond_to?(:each).should == true
\ No newline at end of file