fc90ba1813f52baa57d9810ad935343613dd3475
[ruby_koans.git] / koans / about_triangle_project_2.rb
1 require File.expand_path(File.dirname(__FILE__) + '/edgecase')
2
3 # You need to write the triangle method in the file 'triangle.rb'
4 require 'triangle.rb'
5
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
15  end
16 end
17