1 require File.expand_path(File.dirname(__FILE__) + '/edgecase')
3 class AboutTrueAndFalse < EdgeCase::Koan
4 def truth_value(condition)
12 def test_true_is_treated_as_true
13 assert_equal __, truth_value(true)
16 def test_false_is_treated_as_false
17 assert_equal __, truth_value(false)
20 def test_nil_is_treated_as_false_too
21 assert_equal __, truth_value(nil)
24 def test_everything_else_is_treated_as_true
25 assert_equal __, truth_value(1)
26 assert_equal __, truth_value(0)
27 assert_equal __, truth_value([])
28 assert_equal __, truth_value({})
29 assert_equal __, truth_value("Strings")
30 assert_equal __, truth_value("")