Sha256: d8a3b34a6057b9b26cee2a5d4f685917dab7384d3709d3e85420ea1ef0491f28
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
require "rubygems" require "bundler" Bundler.require(:default, :development) require "minitest/autorun" # For testing Termite itself, use the local version *first*. $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..", "lib") require "termite" class Scope::TestCase def set_up_ecology(file_contents, filename = "some.ecology") ENV["ECOLOGY_SPEC"] = filename File.expects(:exist?).with(filename).returns(true) File.expects(:read).with(filename).returns(file_contents) end def initialize_environment unless @initialized_test_env Time.stubs(:now).returns(Time.at(1315433360)) Socket.stubs(:gethostname).returns("samplehost") Process.stubs(:pid).returns("1234") Ecology.stubs(:thread_id).returns("main") @initialized_test_env = true end end # This adds the Mocha expectation for this call. Technically it also # returns the expectation, so you could modify it later if you wanted. def expect_add(socket, severity_num, message, options = {}) initialize_environment app = options[:application] || "foo_app" string = "<#{Syslog::LOG_LOCAL6 + severity_num}>Sep 7 15:09:20 samplehost #{app} [1234]: [main] #{message}" options[:method] ||= :send options[:extra_args] ||= [0, "0.0.0.0", 514] socket.expects(options[:method]).with(string, *options[:extra_args]) end def expect_console_add(socket, severity_num, message, options = {}) initialize_environment app = options[:application] || "foo_app" options[:method] ||= :send options[:extra_args] ||= [0, "0.0.0.0", 514] socket.expects(options[:method]).with(message, *options[:extra_args]) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
termite-0.0.10 | test/test_helper.rb |