Sorry, hit the tab and enter key too soon :)

You'd stub out the model.

class DummyModel
  acts_as_curseable
end

it "should ask the database to set up a transaction" do
  DummyModel.connection.should_receive("BEGIN;").once
  ... then the execution code to make that happen
end

it "should ask the database to set up a cursor" do
  DummyModel.connection.should_receive("DECLARE dummy_model_cursor
CURSOR FOR...;").once
  ... then the execution code to make that happen
end

it "should tell the database to give it another X rows" do
  DummyModel.should_receive(:find_by_sql).with("FETCH 500 FROM
dummy_model_cursor;")
  ... then the execution code to make that happen
end


Hope that sort of starts you off :)

And if you like 'acts_as_curseable' for the plugin name, I want
acknowledgement :D

-- 
http://lindsaar.net/
Rails, RSpec and Life blog....
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to