Skip to content

Instantly share code, notes, and snippets.

@shingara
Forked from Farzy/gist:111734
Created May 14, 2009 16:11
Show Gist options
  • Save shingara/111739 to your computer and use it in GitHub Desktop.
Save shingara/111739 to your computer and use it in GitHub Desktop.
describe 'handle 2 DNS NOTIFY message' do
before(:each) do
Multilog::SlaveZones.any_instance.expects(:authorized?).returns(true).twice
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 = Multilog::App.new([ '-c', @config_file, 't', './main' ])
app.run
stdout_file.rewind
@output = stdout_file.readlines
end
it "should match with multilog-axfr v.* started." do
@output[0].should match(/^multilog-axfr v.* started.$/)
end
it 'should each TINYDNS_LOG_SAMPLE' do
(1..3).each do |n|
@output[n].should == TINYDNS_LOG_SAMPLE[n+2]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment