yasuyuki-nicovideo 0.1.8.1 → 0.1.8.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/nicovideo.rb CHANGED
@@ -14,6 +14,7 @@ require 'nicovideo/ranking'
14
14
  require 'nicovideo/random'
15
15
  require 'nicovideo/newarrival'
16
16
  require 'nicovideo/thumbnail'
17
+ require 'nicovideo/advertise'
17
18
  #require 'nicovideo/tags'
18
19
  #require 'nicovideo/ichiba'
19
20
  #require 'nicovideo/feed'
@@ -0,0 +1,69 @@
1
+ require File.dirname(__FILE__) + '/../test_helper.rb'
2
+
3
+ class TestNicovideoCommunityMain < Test::Unit::TestCase
4
+
5
+ def setup
6
+ account = YAML.load_file(ENV['HOME'] + '/.nicovideo/account.yml')
7
+ @nv = Nicovideo.new(account['mail'], account['password'])
8
+ @nv.login
9
+
10
+ @cid_valid = 'co2389' # 公開コミュニティ
11
+ @cid_invalid = 'smfdsaf' # IDが間違っている
12
+ @cid_notjoined = 'co8' # 非公開
13
+ end
14
+
15
+ def test_community_valid
16
+ co = nil
17
+ assert_nothing_raised {
18
+ co = @nv.community(@cid_valid)
19
+ }
20
+ assert_instance_of(Nicovideo::Community::Main, co)
21
+ puts co.id
22
+ puts co.url
23
+ puts co.title
24
+ #puts co.description
25
+ puts co.tags.size
26
+ co.tags.each {|t|
27
+ puts t
28
+ }
29
+ assert_equal(@cid_valid, co.id)
30
+ assert_equal("http://ch.nicovideo.jp/community/" + @cid_valid, co.url)
31
+ assert_instance_of(String, co.title)
32
+ assert_instance_of(String, co.description)
33
+ assert_instance_of(Array, co.tags)
34
+
35
+ sleep 5
36
+ end
37
+
38
+ def test_community_invalid
39
+ co = nil
40
+ assert_nothing_raised {
41
+ co = @nv.community(@cid_invalid)
42
+ }
43
+
44
+ assert_equal(@cid_invalid, co.id)
45
+ assert_equal("http://ch.nicovideo.jp/community/" + @cid_invalid, co.url)
46
+
47
+ assert_raise(Nicovideo::NotFound) { co.title }
48
+ assert_raise(Nicovideo::NotFound) { co.description }
49
+ assert_raise(Nicovideo::NotFound) { co.tags }
50
+
51
+ sleep 5
52
+ end
53
+
54
+ def test_community_notopened
55
+ co = nil
56
+ assert_nothing_raised {
57
+ co = @nv.community(@cid_notjoined)
58
+ }
59
+
60
+ assert_equal(@cid_notjoined, co.id)
61
+ assert_equal("http://ch.nicovideo.jp/community/" + @cid_notjoined, co.url)
62
+
63
+ assert_raise(Nicovideo::Forbidden) { co.title }
64
+ assert_raise(Nicovideo::Forbidden) { co.description }
65
+ assert_raise(Nicovideo::Forbidden) { co.tags }
66
+
67
+ sleep 5
68
+ end
69
+ end
@@ -0,0 +1,25 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+ require 'kagemusha'
3
+ require 'open-uri'
4
+
5
+ class Test_Advertise < Test::Unit::TestCase
6
+ def setup
7
+ end
8
+
9
+ def test_get
10
+ tag_info = Nicovideo::Advertise.tag_info("平沢進")
11
+ puts tag_info
12
+ assert_instance_of(Hash, tag_info)
13
+ end
14
+
15
+ def test_get_timeout
16
+ Kagemusha.new(Kernel) do |m|
17
+ m.def(:open) { sleep 30 }
18
+ m.swap {
19
+ assert_raise(TimeoutError) {
20
+ Nicovideo::Advertise.tag_info("平沢進")
21
+ }
22
+ }
23
+ end
24
+ end
25
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yasuyuki-nicovideo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.1
4
+ version: 0.1.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - emergent
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-29 00:00:00 -07:00
12
+ date: 2009-05-26 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,17 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.6.0
23
+ version: 0.9.2
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: json
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.1.4
24
34
  version:
25
35
  - !ruby/object:Gem::Dependency
26
36
  name: hoe
@@ -78,8 +88,10 @@ files:
78
88
  - sample/nv_mylist.rb
79
89
  - sample/nv_openlist.rb
80
90
  - sample/nv_ranking.rb
91
+ - test/community/test_community_main.rb
92
+ - test/test_advertise.rb
81
93
  - test/test_thumbnail.rb
82
- has_rdoc: true
94
+ has_rdoc: false
83
95
  homepage: http://nicovideo.rubyforge.org
84
96
  post_install_message:
85
97
  rdoc_options:
@@ -107,6 +119,8 @@ signing_key:
107
119
  specification_version: 3
108
120
  summary: utils for nicovideo
109
121
  test_files:
122
+ - test/community/test_community_main.rb
123
+ - test/test_advertise.rb
110
124
  - test/test_helper.rb
111
125
  - test/test_login.rb
112
126
  - test/test_mylist.rb