Project

General

Profile

« Previous | Next » 

Revision c74610f9

Added by Walden Raines about 9 years ago

Fixes #10402: add to_bool function for converting to boolean.

This commit adds a to_bool function for casting values to boolean
as well as an example usage.

http://projects.theforeman.org/issues/10402

View differences:

test/unit/setting_test.rb
check_parsed_value "boolean", false, "false"
check_parsed_value "boolean", true, "True"
check_parsed_value "boolean", false, "False"
check_parsed_value_failure "boolean", "1"
check_parsed_value_failure "boolean", "0"
check_parsed_value "boolean", true, "1"
check_parsed_value "boolean", false, "0"
check_parsed_value_failure "boolean", "unknown"
end

Also available in: Unified diff