Skip to content

Instantly share code, notes, and snippets.

/test_spec.rb Secret

Created November 12, 2010 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/fdb0907fcae297006f92 to your computer and use it in GitHub Desktop.
Save anonymous/fdb0907fcae297006f92 to your computer and use it in GitHub Desktop.
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