grin 1.0.0 → 1.1.1
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/lib/grin/album.rb +4 -0
- data/lib/grin/category.rb +4 -0
- data/lib/grin/client.rb +4 -0
- data/lib/test.rb +1 -0
- data/test/test_grin.rb +16 -3
- metadata +5 -5
data/lib/grin/album.rb
CHANGED
data/lib/grin/category.rb
CHANGED
data/lib/grin/client.rb
CHANGED
@@ -72,5 +72,9 @@ module Grin
|
|
72
72
|
JSON.parse(RestClient.post("http://#{@@auth_string}.#{DOMAIN}/api/#{API_VERSION}/#{path}", params))
|
73
73
|
end
|
74
74
|
|
75
|
+
def delete(path)
|
76
|
+
JSON.parse(RestClient.delete("http://#{@@auth_string}.#{DOMAIN}/api/#{API_VERSION}/#{path}"))
|
77
|
+
end
|
78
|
+
|
75
79
|
end
|
76
80
|
end
|
data/lib/test.rb
CHANGED
data/test/test_grin.rb
CHANGED
@@ -18,22 +18,35 @@ class TestGrin < Test::Unit::TestCase
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
context "creating albums and categories" do
|
21
|
+
context "creating and deleting albums and categories" do
|
22
22
|
setup do
|
23
23
|
@category = @fotogger.find_or_create_category("My Category")
|
24
24
|
@album = @fotogger.find_or_create_album("My Album", @category.id)
|
25
25
|
end
|
26
26
|
|
27
27
|
should "return the category name" do
|
28
|
+
assert_kind_of Grin::Category, @category
|
28
29
|
assert_equal @category.name, "My Category"
|
29
30
|
end
|
30
31
|
|
31
32
|
should "return the album title and category name" do
|
32
|
-
|
33
|
-
|
33
|
+
assert_kind_of Grin::Album, @album
|
34
34
|
assert_equal @album.title, "My Album"
|
35
35
|
assert_equal @album.category['name'], @category.name
|
36
36
|
end
|
37
|
+
|
38
|
+
should "not allow you to delete the category when the album exists" do
|
39
|
+
response = @category.destroy
|
40
|
+
assert_equal "Cannot delete category that contains albums", response['error']
|
41
|
+
end
|
42
|
+
|
43
|
+
should "delete the album followed by the category" do
|
44
|
+
album_response = @album.destroy
|
45
|
+
category_response = @category.destroy
|
46
|
+
assert_equal "ok", album_response['status']
|
47
|
+
assert_equal "ok", category_response['status']
|
48
|
+
end
|
49
|
+
|
37
50
|
end
|
38
51
|
|
39
52
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 1
|
9
|
+
- 1
|
10
|
+
version: 1.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- James Miller
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-27 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|