Instantly share code, notes, and snippets.

anonymous /test_spec.rb Secret
Created Nov 12, 2010

Embed
What would you like to do?
require 'spec_helper'
class ProcessLogFiles
def start
# for log in logfiles
LogFile.new.process #log
# end
end
end
class LogFile
def process
# for line in log
# if some condition is met
LogMail.new.send # or some other meth with no side-effect
# end
# end
end
end
class LogMail
def send
end
end
describe "testing nest" do
it "should show that a function was called" do
LogMail.any_instance.stubs(:send).runs { $ran_meth = true }
ProcessLogFiles.new.start
$ran_meth.should == true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment