1 require File.expand_path(File.dirname(__FILE__) + '/edgecase')
3 # You need to write the triangle method in the file 'triangle.rb'
6 class AboutTriangleProject2 < EdgeCase::Koan
7 # The first assignment did not talk about how to handle errors.
8 # Let's handle that part now.
9 def test_illegal_triangles_throw_exceptions
10 assert_raise(TriangleError) do triangle(0, 0, 0) end
11 assert_raise(TriangleError) do triangle(3, 4, -5) end
12 assert_raise(TriangleError) do triangle(1, 1, 3) end
13 assert_raise(TriangleError) do triangle(2, 4, 2) end
14 #HINT: for tips, see http://stackoverflow.com/questions/3834203/ruby-koan-151-raising-exceptions