hubba 0.4.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,45 +0,0 @@
1
- # encoding: utf-8
2
-
3
- ###
4
- # to run use
5
- # ruby -I ./lib -I ./test test/test_cache.rb
6
-
7
-
8
- require 'helper'
9
-
10
-
11
- class TestCache < MiniTest::Test
12
-
13
- def setup
14
- @cache = Hubba::Cache.new( "#{Hubba.root}/test/cache" )
15
- end
16
-
17
- def test_basename
18
- mappings = [['/users/geraldb', 'users~geraldb'],
19
- ['/users/geraldb/repos', 'users~geraldb~repos'],
20
- ['/users/geraldb/repos?per_page=100', 'users~geraldb~repos'],
21
- ['/users/geraldb/orgs', 'users~geraldb~orgs'],
22
- ['/users/geraldb/orgs?per_page=100', 'users~geraldb~orgs'],
23
- ['/orgs/wikiscript/repos', 'orgs~wikiscript~repos'],
24
- ['/orgs/planetjekyll/repos', 'orgs~planetjekyll~repos'],
25
- ['/orgs/vienna-rb/repos', 'orgs~vienna-rb~repos']]
26
-
27
- mappings.each do |mapping|
28
- assert_equal mapping[1], @cache.request_uri_to_basename( mapping[0] )
29
- end
30
- end # method test_basename
31
-
32
- def test_cache
33
- orgs = @cache.get( '/users/geraldb/orgs' )
34
- assert_equal 4, orgs.size
35
-
36
- repos = @cache.get( '/users/geraldb/repos' )
37
- assert_equal 3, repos.size
38
- end # method test_cache
39
-
40
- def test_cache_miss
41
- assert_nil @cache.get( '/test/hello' )
42
- assert_nil @cache.get( '/test/hola' )
43
- end # method test_cache_miss
44
-
45
- end # class TestCache