提交 5e2f4ce0 编写于 作者: J Justin Collins

Add tests for quiet option

上级 c3c0f1db
require 'tempfile'
class UtilTests < Test::Unit::TestCase
def setup
@ruby_parser = RubyParser
......@@ -50,4 +52,47 @@ class BaseCheckTests < Test::Unit::TestCase
def test_version_between_pre_release
assert version_between?("3.2.9.rc2", "3.2.5", "4.0.0")
end
def test_quiet_option_from_file
config = Tempfile.new("config")
config.write <<-YAML.strip
---
:quiet: true
YAML
config.close
options = {
:config_file => config.path,
:app_path => "/tmp" #doesn't need to be real
}
final_options = Brakeman.set_options(options)
config.unlink
assert final_options[:quiet], "Expected quiet option to be true, but was #{final_options[:quiet]}"
end
def test_quiet_option_default
options = {
:app_path => "/tmp" #doesn't need to be real
}
final_options = Brakeman.set_options(options)
assert final_options[:quiet], "Expected quiet option to be true, but was #{final_options[:quiet]}"
end
def test_quiet_option_with_nil
options = {
:quiet => nil,
:app_path => "/tmp" #doesn't need to be real
}
final_options = Brakeman.set_options(options)
assert_nil final_options[:quiet]
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册