-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
edad094
commit 99c290a
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
require 'test_helper' | ||
require 'sensu-plugin/utils' | ||
|
||
class TestCastBoolInt < MiniTest::Test | ||
include SensuPluginTestHelper | ||
include Sensu::Plugin::Utils | ||
|
||
def test_integer | ||
assert_equal 567.89, cast_bool_values_int(567.89) | ||
end | ||
|
||
def test_false_boolean | ||
assert_equal 0, cast_bool_values_int(false) | ||
end | ||
|
||
def test_true_boolean | ||
assert_equal 1, cast_bool_values_int(true) | ||
end | ||
|
||
def test_false_string | ||
assert_equal 0, cast_bool_values_int('false') | ||
end | ||
|
||
def test_true_string | ||
assert_equal 1, cast_bool_values_int('true') | ||
end | ||
|
||
def test_arbirtrary_string | ||
assert_equal 'foo', cast_bool_values_int('foo') | ||
end | ||
end |