claire_client 0.0.2 → 0.0.3

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{claire_client}
8
- s.version = "0.0.2"
8
+ s.version = "0.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matheus E. Muller"]
@@ -39,6 +39,7 @@ Gem::Specification.new do |s|
39
39
  "spec/fixtures/item_direct.xml",
40
40
  "spec/fixtures/item_with_channel.xml",
41
41
  "spec/fixtures/list.xml",
42
+ "spec/fixtures/list_with_one_item.xml",
42
43
  "spec/spec.opts",
43
44
  "spec/spec_helper.rb"
44
45
  ]
@@ -14,8 +14,10 @@ module Claire
14
14
  @document = @document.channel if @document.channel
15
15
  if @document.item.nil?
16
16
  @items = []
17
- else
17
+ elsif @document.item.is_a? Array
18
18
  @items = @document.item
19
+ else
20
+ @items = [@document.item]
19
21
  end
20
22
  build_items
21
23
  end
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
3
3
 
4
4
  describe Claire::Client::List do
5
5
 
6
- before do
6
+ before :each do
7
7
  Claire::Client.stub(:get).with('categories').and_return(xml(:item_with_channel))
8
8
  @list = Claire::Client::List.new('categories')
9
9
  end
@@ -49,6 +49,12 @@ describe Claire::Client::List do
49
49
 
50
50
  it "the returned objects should be set as partial" do
51
51
  @list.each { |item| item.should be_partial }
52
+ end
53
+
54
+ it "should work normally even when the list has only one item" do
55
+ Claire::Client.stub(:get).with('categories').and_return(xml(:list_with_one_item))
56
+ @list = Claire::Client::List.new('categories')
57
+ @list.each.size.should be 1
52
58
  end
53
59
  end
54
60
 
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="utf-8" standalone="yes"?>
2
+
3
+ <rss version="2.0" xmlns:media="http://search.yahoo.com/mrss" xmlns:atom="http://www.w3.org/2005/Atom">
4
+
5
+ <item>
6
+ <title>test</title>
7
+ <link>http://localhost:3000/categories/4bb48ef61637fd69c1000005</link>
8
+ <num_videos>1</num_videos>
9
+ </item>
10
+
11
+ </rss>
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Matheus E. Muller
@@ -91,6 +91,7 @@ files:
91
91
  - spec/fixtures/item_direct.xml
92
92
  - spec/fixtures/item_with_channel.xml
93
93
  - spec/fixtures/list.xml
94
+ - spec/fixtures/list_with_one_item.xml
94
95
  - spec/spec.opts
95
96
  - spec/spec_helper.rb
96
97
  has_rdoc: true