murlsh 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +5 -3
- data/VERSION +1 -1
- data/config.yaml +1 -1
- data/lib/murlsh/atom_feed.rb +13 -14
- data/lib/murlsh/doc.rb +34 -0
- data/lib/murlsh/failproof.rb +15 -0
- data/lib/murlsh/uri.rb +12 -0
- data/lib/murlsh/uri_ask.rb +84 -0
- data/lib/murlsh/url.rb +4 -4
- data/lib/murlsh/url_body.rb +4 -10
- data/lib/murlsh.rb +4 -3
- data/murlsh.gemspec +12 -15
- data/plugins/lookup_content_type_title.rb +3 -2
- data/public/css/jquery.jgrowl.css +8 -7
- data/public/css/screen.css +10 -2
- data/public/js/jquery-1.4.min.js +151 -0
- data/public/js/jquery.jgrowl_compressed.js +38 -18
- data/public/js/js.js +222 -203
- data/test/atom_feed_test.rb +101 -0
- data/test/uri_ask_test.rb +100 -0
- metadata +11 -14
- data/lib/murlsh/get_content_type.rb +0 -92
- data/lib/murlsh/get_title.rb +0 -72
- data/lib/murlsh/referrer.rb +0 -50
- data/public/js/jquery-1.3.2.min.js +0 -19
- data/test/get_charset_test.rb +0 -25
- data/test/get_content_type_test.rb +0 -63
- data/test/get_title_test.rb +0 -43
- data/test/referrer_test.rb +0 -71
data/test/get_title_test.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
|
3
|
-
require 'murlsh'
|
4
|
-
|
5
|
-
require 'test/unit'
|
6
|
-
|
7
|
-
class GetTitleTest < Test::Unit::TestCase
|
8
|
-
|
9
|
-
def noop(url)
|
10
|
-
assert_equal(url, Murlsh.get_title(url))
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_nil
|
14
|
-
noop(nil)
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_empty
|
18
|
-
noop('')
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_invalid_url
|
22
|
-
noop('foo')
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_invalid_host
|
26
|
-
noop('http://28fac7a1ac51976c90016509d97c89ba.edu/')
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_good
|
30
|
-
assert_equal('Google', Murlsh.get_title('http://www.google.com/'))
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_failproof_true
|
34
|
-
noop(Murlsh.get_title('http://x.boedicker.org/', :failproof => true))
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_failproof_false
|
38
|
-
assert_raise SocketError do
|
39
|
-
Murlsh.get_title('http://x.boedicker.org/', :failproof => false)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
data/test/referrer_test.rb
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
|
3
|
-
require 'murlsh'
|
4
|
-
|
5
|
-
require 'test/unit'
|
6
|
-
|
7
|
-
class ReferrerTest < Test::Unit::TestCase
|
8
|
-
|
9
|
-
def setup
|
10
|
-
@qmap = {
|
11
|
-
/www\.foo\.com\/search/ => 'q',
|
12
|
-
}
|
13
|
-
end
|
14
|
-
|
15
|
-
def instantiate(url)
|
16
|
-
Murlsh::Referrer.new(url)
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_url_nil
|
20
|
-
r = instantiate(nil)
|
21
|
-
assert_equal('', r.hostpath)
|
22
|
-
assert_equal({}, r.query_string)
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_url_nil_block
|
26
|
-
r = instantiate(nil)
|
27
|
-
r.search_query(@qmap) { |x| flunk }
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_url_empty
|
31
|
-
r = instantiate('')
|
32
|
-
assert_equal('', r.hostpath)
|
33
|
-
assert_equal({}, r.query_string)
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_url_empty_block
|
37
|
-
r = instantiate('')
|
38
|
-
r.search_query(@qmap) { |x| flunk }
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_hostpath_not_found
|
42
|
-
r = instantiate('http://www.bar.com/search?q=test&a=1&b=2&c=3')
|
43
|
-
assert_equal(nil, r.search_query(@qmap))
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_hostpath_not_found_block
|
47
|
-
r = instantiate('http://www.bar.com/search?q=test&a=1&b=2&c=3')
|
48
|
-
r.search_query(@qmap) { |x| flunk }
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_query_not_found
|
52
|
-
r = instantiate('http://www.foo.com/search?a=1&b=2&c=3')
|
53
|
-
assert_equal(nil, r.search_query(@qmap))
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_query_not_found_block
|
57
|
-
r = instantiate('http://www.foo.com/search?a=1&b=2&c=3')
|
58
|
-
r.search_query(@qmap) { |x| flunk }
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_good
|
62
|
-
r = instantiate('http://www.foo.com/search?q=test&a=1&b=2&c=3')
|
63
|
-
assert_equal('test', r.search_query(@qmap))
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_good_block
|
67
|
-
r = instantiate('http://www.foo.com/search?q=test&a=1&b=2&c=3')
|
68
|
-
r.search_query(@qmap) { |x| assert_equal('test', x) }
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|