Skip to content

Instantly share code, notes, and snippets.

@Farzy
Created May 14, 2009 15:59
Show Gist options
  • Save Farzy/111734 to your computer and use it in GitHub Desktop.
Save Farzy/111734 to your computer and use it in GitHub Desktop.
it "should handle 2 DNS NOTIFY messages" do
Multilog::SlaveZones.any_instance.expects(:authorized?).returns(true).twice
app = Multilog::App.new([ '-c', @config_file, 't', './main' ])
stdout_file = File.open(File.join(@test_root, 'stdout.log'), 'w+')
IO.expects(:popen).with('multilog t ./main', 'w').returns(stdout_file)
STDIN.expects(:gets).times(4).returns(*TINYDNS_LOG_SAMPLE[3..5]).then.returns(false)
Multilog::App.any_instance.expects(:system).times(4)
Multilog::App.any_instance.expects(:fork).twice.returns(100, 200)
Process.expects(:detach).twice.with(any_of(100, 200))
app.run
stdout_file.rewind
output = stdout_file.readlines
output[0].should match(/^multilog-axfr v.* started.$/)
(1..3).each do |n|
output[n].should == TINYDNS_LOG_SAMPLE[n+2]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment