Rewrite test with BSD::Control::Test
This commit is contained in:
parent
aea59dc9bc
commit
316c6c1f1e
1 changed files with 18 additions and 16 deletions
|
@ -2,25 +2,27 @@
|
||||||
|
|
||||||
require_relative "../setup"
|
require_relative "../setup"
|
||||||
|
|
||||||
class ReadmeExamplesTest < Test::Unit::TestCase
|
module BSD::Control
|
||||||
require "rbconfig"
|
class ReadmeExamplesTest < BSD::Control::Test
|
||||||
require "test/cmd"
|
require "rbconfig"
|
||||||
|
require "test/cmd"
|
||||||
|
|
||||||
def test_available_features_success
|
def test_available_features_success
|
||||||
assert_equal true,
|
assert_equal true,
|
||||||
cmd(RbConfig.ruby, readme_example("1_available_features.rb"))
|
cmd(RbConfig.ruby, readme_example("1_available_features.rb"))
|
||||||
.status.success?
|
.status.success?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_available_features_stdout
|
def test_available_features_stdout
|
||||||
cmd(RbConfig.ruby, readme_example("1_available_features.rb"))
|
cmd(RbConfig.ruby, readme_example("1_available_features.rb"))
|
||||||
.stdout
|
.stdout
|
||||||
.each_line { assert_match %r{The [a-zA-Z0-9_]+ feature is available}, _1 }
|
.each_line { assert_match %r{The [a-zA-Z0-9_]+ feature is available}, _1 }
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def readme_example(name)
|
def readme_example(name)
|
||||||
File.join(Dir.getwd, "share", "bsdcontrol.rb", "examples", name)
|
File.join(Dir.getwd, "share", "bsdcontrol.rb", "examples", name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue