Permalink
Browse files

Alias [] to find in collection resources

  • Loading branch information...
1 parent ac17350 commit 54d20b2a52e2c0c4682179ebb9bd5221edf8506d @vesan committed Jul 19, 2012
Showing with 8 additions and 0 deletions.
  1. +2 −0 lib/kippt/collection_resource.rb
  2. +6 −0 spec/spec_helper.rb
@@ -13,6 +13,8 @@ def [](resource_id)
object_class.new(@client.get("#{base_uri}/#{resource_id}").body)
end
+ alias find []
+
def collection_from_url(url)
raise ArgumentError.new("The parameter URL can't be blank") if url.nil? || url == ""
View
@@ -63,6 +63,12 @@ def fixture(file)
end
end
+ describe "#find" do
+ it "exists" do
+ subject.respond_to?(:find).should be_true
+ end
+ end
+
describe "#collection_from_url" do
it "returns a new collection" do
stub_get("/#{base_uri}/?limit=20&offset=20").

0 comments on commit 54d20b2

Please sign in to comment.