myflickr 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/myflickr/photo.rb +1 -1
- data/lib/myflickr/version.rb +1 -1
- data/spec/photo_spec.rb +14 -0
- metadata +1 -1
data/lib/myflickr/photo.rb
CHANGED
@@ -21,7 +21,7 @@ module Myflickr
|
|
21
21
|
|
22
22
|
# Set tags for photo
|
23
23
|
photo.tags = (photo_call/:tag).map{|tag| Tag.new tag.inner_text}
|
24
|
-
photo.machine_tags = (photo_call
|
24
|
+
photo.machine_tags = (photo_call/"tag[@machine_tag=1]").map{|tag| MachineTag.from_s tag.inner_text }
|
25
25
|
|
26
26
|
return photo
|
27
27
|
end
|
data/lib/myflickr/version.rb
CHANGED
data/spec/photo_spec.rb
CHANGED
@@ -19,10 +19,19 @@ describe Photo, "class" do
|
|
19
19
|
|
20
20
|
it "should have tags" do
|
21
21
|
Photo.public_instance_methods.should include "tags"
|
22
|
+
tags = Photo.find("252091410").tags
|
23
|
+
tags.should be_an_instance_of(Array)
|
24
|
+
tags.first.should be_an_instance_of(Tag)
|
22
25
|
end
|
23
26
|
|
24
27
|
it "should have machine_tags" do
|
25
28
|
Photo.public_instance_methods.should include "machine_tags"
|
29
|
+
machine_tags = Photo.find("252091410").machine_tags
|
30
|
+
machine_tags.should be_an_instance_of(Array)
|
31
|
+
machine_tags.first.should be_an_instance_of(MachineTag)
|
32
|
+
machine_tags.first.namespace.should eql "flickrfolio"
|
33
|
+
machine_tags.first.predicate.should eql "test"
|
34
|
+
machine_tags.first.value.should eql "spec"
|
26
35
|
end
|
27
36
|
|
28
37
|
it "should have an array of hashes that contain Size class instances" do
|
@@ -44,4 +53,9 @@ describe "Searching" do
|
|
44
53
|
search.should be_an_instance_of(Array)
|
45
54
|
search.first.should be_an_instance_of(Photo)
|
46
55
|
end
|
56
|
+
|
57
|
+
it "should find a photo by id" do
|
58
|
+
photo = Photo.find "252091410"
|
59
|
+
photo.should be_an_instance_of(Photo)
|
60
|
+
end
|
47
61
|
end
|