summaryrefslogtreecommitdiff
path: root/test/error.rb
blob: a97a929f7490d83d1f113d2cf1367b2402f1fbc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require_relative "setup.rb"

class ErrorTest < MiniTest::Test

  def test_bad_request
    object = OpenTox::Feature.new 
    assert_raises OpenTox::ResourceNotFoundError do
      response = object.get
    end
  end

  def test_error_methods
    assert_raises OpenTox::ResourceNotFoundError do
      resource_not_found_error "This is a test"
    end
  end

  def test_exception
    assert_raises Exception do
      raise Exception.new "Basic Exception"
    end
  end

  def test_backtick
    assert_raises OpenTox::InternalServerError do
      `this call will not work`
    end
    assert_raises OpenTox::InternalServerError do
      `ls inexisting_directory`
    end
  end

end