summaryrefslogtreecommitdiff
path: root/test/functional/bin_test.rb
diff options
context:
space:
mode:
authorazul <azul@riseup.net>2016-10-17 08:58:08 +0000
committerazul <azul@riseup.net>2016-10-17 08:58:08 +0000
commit5dae257996c480c3f7b5a220fcaf97812a560466 (patch)
tree2edc9f7b40d7b04e4cf739e6e92b200f93cd57e7 /test/functional/bin_test.rb
parent6721f0732facd87404eecc288357fd1bd0de48cf (diff)
parent5967c4a568aff2c5e73e3ab933aa68d25387aeb1 (diff)
Merge branch 'feature/log-requests-and-errors' into 'master'
Log requests and errors proper logging See merge request !6
Diffstat (limited to 'test/functional/bin_test.rb')
-rw-r--r--test/functional/bin_test.rb30
1 files changed, 28 insertions, 2 deletions
diff --git a/test/functional/bin_test.rb b/test/functional/bin_test.rb
index bc15e38..ef2d74e 100644
--- a/test/functional/bin_test.rb
+++ b/test/functional/bin_test.rb
@@ -4,19 +4,45 @@ require 'minitest/hell'
class BinTest < Minitest::Test
+ def teardown
+ run_command "stop"
+ end
+
def test_bin_loading
assert_command_runs("version")
- assert_equal 0, $?.exitstatus
+ end
+
+ def test_not_running_by_default
+ assert_stopped
+ end
+
+ def test_start
+ run_command "start"
+ assert_running
end
protected
+ def assert_running
+ status = run_command "status"
+ assert_includes status, "Nickserver running"
+ end
+
+ def assert_stopped
+ status = run_command "status"
+ assert_includes status, "No nickserver processes are running."
+ end
+
def assert_command_runs(command)
- out = `#{path_to_executable} #{command} 2>&1`
+ out = run_command command
assert ($?.exitstatus == 0),
"failed to run 'nickserver #{command}':\n #{out}"
end
+ def run_command(command)
+ `#{path_to_executable} #{command} 2>&1`
+ end
+
def path_to_executable
File.expand_path(File.dirname(__FILE__) + '/../../bin/nickserver')
end