Restrict assert checks to .rb files.
[ruby_koans.git] / koans / about_asserts.rb
1 #!/usr/bin/env ruby
2 # -*- ruby -*-
3
4 require File.expand_path(File.dirname(__FILE__) + '/edgecase')
5
6 class AboutAsserts < EdgeCase::Koan
7
8   # We shall contemplate truth by testing reality, via asserts.
9   def test_assert_truth
10     assert false                # This should be true
11   end
12
13   # Enlightenment may be more easily achieved with appropriate
14   # messages.
15   def test_assert_with_message
16     assert false, "This should be true -- Please fix this"
17   end
18
19   # To understand reality, we must compare our expectations against
20   # reality.
21   def test_assert_equality
22     expected_value = __
23     actual_value = 1 + 1
24
25     assert expected_value == actual_value
26   end
27
28   # Some ways of asserting equality are better than others.
29   def test_a_better_way_of_asserting_equality
30     expected_value = __
31     actual_value = 1 + 1
32
33     assert_equal expected_value, actual_value
34   end
35
36   # Sometimes we will ask you to fill in the values
37   def test_fill_in_values
38     assert_equal __, 1 + 1
39   end
40 end