-
Notifications
You must be signed in to change notification settings - Fork 16
/
site_test.rb
46 lines (36 loc) · 1.08 KB
/
site_test.rb
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
34
35
36
37
38
39
40
41
42
43
44
45
46
# encoding: UTF-8
ENV['RACK_ENV'] = 'test'
require 'test/unit'
require './site'
require 'rack/test'
class SiteTest < Test::Unit::TestCase
include Rack::Test::Methods
def app
Sinatra::Application
end
def test_home
get '/'
assert last_response.ok?
assert_equal 'text/html;charset=utf-8', last_response.header['Content-Type']
end
def test_search
get '/?q=open'
assert last_response.ok?
assert_equal 'text/html;charset=utf-8', last_response.header['Content-Type']
end
def test_source
get '/dataset/37249992-Project-Gutenberg'
assert last_response.ok?
assert_equal 'text/html;charset=utf-8', last_response.header['Content-Type']
end
def test_source_xml
get '/dataset/37249992-Project-Gutenberg.xml'
assert last_response.ok?
assert_equal 'application/xml;charset=utf-8', last_response.header['Content-Type']
end
def test_source_json
get '/dataset/37249992-Project-Gutenberg.json'
assert last_response.ok?
assert_equal 'application/json', last_response.header['Content-Type']
end
end