From 316c6c1f1e6b16a1c82cdbfb3d347b5c055a4025 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Sun, 12 May 2024 22:50:19 -0300 Subject: [PATCH] Rewrite test with BSD::Control::Test --- test/unprivileged/readme_examples_test.rb | 34 ++++++++++++----------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/test/unprivileged/readme_examples_test.rb b/test/unprivileged/readme_examples_test.rb index 3124ea2..d005e2b 100644 --- a/test/unprivileged/readme_examples_test.rb +++ b/test/unprivileged/readme_examples_test.rb @@ -2,25 +2,27 @@ require_relative "../setup" -class ReadmeExamplesTest < Test::Unit::TestCase - require "rbconfig" - require "test/cmd" +module BSD::Control + class ReadmeExamplesTest < BSD::Control::Test + require "rbconfig" + require "test/cmd" - def test_available_features_success - assert_equal true, - cmd(RbConfig.ruby, readme_example("1_available_features.rb")) - .status.success? - end + def test_available_features_success + assert_equal true, + cmd(RbConfig.ruby, readme_example("1_available_features.rb")) + .status.success? + end - def test_available_features_stdout - cmd(RbConfig.ruby, readme_example("1_available_features.rb")) - .stdout - .each_line { assert_match %r{The [a-zA-Z0-9_]+ feature is available}, _1 } - end + def test_available_features_stdout + cmd(RbConfig.ruby, readme_example("1_available_features.rb")) + .stdout + .each_line { assert_match %r{The [a-zA-Z0-9_]+ feature is available}, _1 } + end - private + private - def readme_example(name) - File.join(Dir.getwd, "share", "bsdcontrol.rb", "examples", name) + def readme_example(name) + File.join(Dir.getwd, "share", "bsdcontrol.rb", "examples", name) + end end end