spec/spidey/strategies/mongo_spec.rb in spidey-mongo-0.0.4 vs spec/spidey/strategies/mongo_spec.rb in spidey-mongo-0.0.5
- old
+ new
@@ -23,10 +23,11 @@
end
it "should add initial URLs to collection" do
doc = @db['urls'].find_one(url: "http://www.cnn.com")
doc['handler'].should == :process_home
+ doc['spider'].should == 'TestSpider'
end
it "should not add duplicate URLs" do
@spider.send :handle, "http://www.cnn.com", :process_home
@db['urls'].find(url: "http://www.cnn.com").count.should == 1
@@ -36,10 +37,11 @@
@spider.record detail_url: 'http://www.cnn.com', foo: 'bar'
@db['results'].count.should == 1
doc = @db['results'].find_one
doc['detail_url'].should == 'http://www.cnn.com'
doc['foo'].should == 'bar'
+ doc['spider'].should == 'TestSpider'
end
it "should update existing result" do
@db['results'].insert key: 'http://foo.bar', detail_url: 'http://foo.bar'
@spider.record detail_url: 'http://foo.bar', foo: 'bar'
@@ -51,8 +53,9 @@
doc = @db['errors'].find_one
doc['error'].should == 'Exception'
doc['url'].should == 'http://www.cnn.com'
doc['handler'].should == :blah
doc['message'].should == 'WTF'
+ doc['spider'].should == 'TestSpider'
end
end
\ No newline at end of file