Permalink
Browse files

added some more specs

  • Loading branch information...
1 parent c3dfc1c commit e397d995af93abf0269fb6eef7c949149193f974 @twoism committed Jun 17, 2010
Showing with 9 additions and 1 deletion.
  1. +8 −0 spec/graboid/scraper_spec.rb
  2. +1 −1 spec/spec_helper.rb
@@ -172,16 +172,24 @@ class Phony; include Graboid::Scraper; end
describe "with a limit" do
before(:each) do
@scraper = ScraperWithPager.new( :source => 'http://localhost:9393/posts' )
+ @scraper.expects(:run_before_paginate_callbacks).times(3)
@posts = @scraper.all(:max_pages => 3)
end
+ it "should set the callback" do
+ @scraper.callbacks[:before_paginate].should be_a Proc
+ end
it "should get 6 posts" do
@posts.length.should == 6
end
+
+
+
end
describe "without a limit" do
before(:each) do
@scraper = ScraperWithPager.new( :source => 'http://localhost:9393/posts' )
+ @scraper.expects(:run_before_paginate_callbacks).times(8)
@posts = @scraper.all
end
it "should get 16 posts" do
View
@@ -5,7 +5,7 @@
require 'spec/autorun'
Spec::Runner.configure do |config|
-
+ config.mock_with :mocha
end
FIXTURE_PATH = File.expand_path(File.dirname(__FILE__)+'/fixtures/posts.html')

0 comments on commit e397d99

Please sign in to comment.