Skip to content

Commit

Permalink
Add some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Evesy authored and majormoses committed Jul 7, 2017
1 parent edad094 commit 99c290a
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/cast_bool_value_test.rb
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

0 comments on commit 99c290a

Please sign in to comment.