Skip to content

Instantly share code, notes, and snippets.

@jonhinson
Created September 23, 2010 20:17
Show Gist options
  • Save jonhinson/594273 to your computer and use it in GitHub Desktop.
Save jonhinson/594273 to your computer and use it in GitHub Desktop.
# working on testing loops like the one below
# describe Foo do
# it "should write hi" do
# Bar.stubs(:create)
# Delayed::Job.stubs(:enqueue)
# Bar.stubs(:first).returns(Bar.new, nil)
# Foo.any_instance.stubs(:sleep)
# foo = Foo.new
# foo.should_receive(:puts).with("hi")
# foo.should_receive(:sleep).with(1)
# foo.foo
# end
# end
def foo
Bar.create
Delayed::Job.enqueue DeleteBarJob.new
while bar = Bar.first
puts "hi"
sleep 1
end
end
@jonhinson
Copy link
Author

oops

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment