nicoquery 0.1.8.8 → 0.1.8.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 562a498e207c749c1d054b6914178dd2235921a3
4
- data.tar.gz: a47deba7f5ec62fa299d0a3489c9c5b4a1b56551
3
+ metadata.gz: df91616f6bc69aa2027a406cbf7089798147a752
4
+ data.tar.gz: c534b11e1fb66304aff2ff15c6b776b2d3bc8fc4
5
5
  SHA512:
6
- metadata.gz: 2e458f9fc86516a133c151fa37324de2a3253d9be775756cf7cd83c060d78a8c59c799bf597e741dc5af9c714bc0ae61c4d26e2f5d241a1cfec4ba8335546c94
7
- data.tar.gz: 7282ba6d0dd85c69ebd7eac1d42aaaff8ae54f74738a7ab340f36f5abd92e24540c812bb9ad46454ed2b5f421c1b42b5b896e55db4c45d1a7e6f6ef6854444e2
6
+ metadata.gz: 2b7128b15c7b6a6dce8e0868fe4e3805076bcf665d0bbb367b40b7dafadbb33eb5fc66bc1c24965a6385f6b3f97211ce4cb6bea5a9e1076addebe1a9b22bea4e
7
+ data.tar.gz: a6b63aeba94fdd6a95c5c9036af4845f74e91707a896e6494bc3e29293435e854a7fa3f52934da1e85f09d2c870d5181288641ffaf22500fc18c7085b621c509
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nicoquery (0.1.8.8)
4
+ nicoquery (0.1.8.9)
5
5
  activesupport (~> 4.0.0)
6
6
  i18n
7
7
  nicoapi
@@ -95,7 +95,9 @@ module NicoQuery
95
95
  def tags
96
96
  tag_obj = @hash['tags']['tag_info']
97
97
 
98
- if tag_obj.instance_of? Array
98
+ if tag_obj.nil?
99
+ tag_array = []
100
+ elsif tag_obj.instance_of? Array
99
101
  tag_array = tag_obj
100
102
  else
101
103
  tag_array = [ tag_obj ]
@@ -1,3 +1,3 @@
1
1
  module NicoQuery
2
- VERSION = "0.1.8.8"
2
+ VERSION = "0.1.8.9"
3
3
  end
@@ -0,0 +1,9 @@
1
+ module Fixture
2
+ def self.video_array_no_tags
3
+ <<-EOS
4
+ <?xml version="1.0" encoding="UTF-8"?>
5
+ <nicovideo_video_response status="ok"><count>1</count><video_info><video><id>sm21130836</id><deleted>0</deleted><title>バイオハザードゆっくリベレーションUE裏の1</title><description>本編とは関係ない動画&lt;br /&gt;コメント返し(二件)が終わったら残りの時間は雑談になっている動画です mylist/37486541&lt;br /&gt;ガンダムとνのバルカン音も入れたのにマシンガンがうるさくて聞こえないね&lt;br /&gt;※タグを付けてもらえるのは嬉しいのですがこの裏の動画はタグ無しでお願いします&lt;br /&gt;</description><length_in_seconds>488</length_in_seconds><size_low>25940040</size_low><movie_type>mp4</movie_type><thumbnail_url>http://tn-skr1.smilevideo.jp/smile?i=21130836</thumbnail_url><upload_time/><first_retrieve>2013-06-16T19:04:57+09:00</first_retrieve><default_thread>1371377097</default_thread><view_counter>172</view_counter><mylist_counter>3</mylist_counter><option_flag_ichiba>0</option_flag_ichiba><option_flag_community>0</option_flag_community><option_flag_domestic>0</option_flag_domestic><option_flag_comment_type>0</option_flag_comment_type><option_flag_adult>0</option_flag_adult><option_flag_mobile>0</option_flag_mobile><option_flag_economy_mp4>1</option_flag_economy_mp4><option_flag_middle_video>0</option_flag_middle_video><option_flag_mobile_ng_apple>0</option_flag_mobile_ng_apple></video><thread><id>1371377097</id><public>1</public><num_res>13</num_res><community_id/></thread><tags><tag_info/></tags></video_info></nicovideo_video_response>
6
+ EOS
7
+ end
8
+ end
9
+
@@ -1,14 +1,16 @@
1
1
  require "nicoquery/object_mapper/video_array"
2
2
  require "fixture/video_array_sm20415650_sm9"
3
+ require "fixture/video_array_no_tags"
3
4
 
4
5
 
5
6
  describe "NicoQuery::ObjectMapper::VideoArray" do
6
- before do
7
- xml = Fixture.video_array_sm20415650_sm9
8
- @result = NicoQuery::ObjectMapper::VideoArray.new xml
9
- end
10
7
 
11
8
  context "sm20415650" do
9
+ before do
10
+ xml = Fixture.video_array_sm20415650_sm9
11
+ @result = NicoQuery::ObjectMapper::VideoArray.new xml
12
+ end
13
+
12
14
  subject { @result.movies[0] }
13
15
 
14
16
  describe "#title" do
@@ -83,12 +85,35 @@ describe "NicoQuery::ObjectMapper::VideoArray" do
83
85
  end
84
86
  end
85
87
 
86
- # context "when a movie doesn't contain more than one tag" do
87
- # describe "#tags" do
88
- # it "returns number of mylist references" do
89
- # expect(subject.tags).to be_a_kind_of Array
90
- # end
91
- # end
92
- # end
88
+ context "when a movie doesn't contain more than one tag" do
89
+ before do
90
+ xml = Fixture.video_array_sm20415650_sm9
91
+ @result = NicoQuery::ObjectMapper::VideoArray.new xml
92
+ end
93
+
94
+ subject { @result.movies[0] }
95
+
96
+ describe "#tags" do
97
+ it "returns number of mylist references" do
98
+ expect(subject.tags).to be_a_kind_of Array
99
+ end
100
+ end
101
+ end
102
+
103
+ context "when a movie contains no tag" do
104
+ before do
105
+ xml = Fixture.video_array_no_tags
106
+ @result = NicoQuery::ObjectMapper::VideoArray.new xml
107
+ end
108
+
109
+ subject { @result.movies[0] }
110
+
111
+ describe "#tags" do
112
+ it "returns empty array" do
113
+ expect(subject.tags).to be_a_kind_of Array
114
+ expect(subject.tags).to be_empty
115
+ end
116
+ end
117
+ end
93
118
 
94
119
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nicoquery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.8
4
+ version: 0.1.8.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masami Yonehara
@@ -269,6 +269,7 @@ files:
269
269
  - spec/fixture/tag_search_yukkuri_page1.rb
270
270
  - spec/fixture/tag_search_yukkuri_page2.rb
271
271
  - spec/fixture/video_array_community.rb
272
+ - spec/fixture/video_array_no_tags.rb
272
273
  - spec/fixture/video_array_sm20415650_sm9.rb
273
274
  - spec/nicoquery_spec.rb
274
275
  - spec/object/movie_spec.rb
@@ -324,6 +325,7 @@ test_files:
324
325
  - spec/fixture/tag_search_yukkuri_page1.rb
325
326
  - spec/fixture/tag_search_yukkuri_page2.rb
326
327
  - spec/fixture/video_array_community.rb
328
+ - spec/fixture/video_array_no_tags.rb
327
329
  - spec/fixture/video_array_sm20415650_sm9.rb
328
330
  - spec/nicoquery_spec.rb
329
331
  - spec/object/movie_spec.rb