Sean Cribbs avatar Sean Cribbs committed 93b8831

Don't load the keys by default when requesting a bucket. Closes #36.

Comments (0)

Files changed (2)

riak-client/lib/riak/client.rb

     # @return [Bucket] the requested bucket
     def bucket(name, options={})
       options.assert_valid_keys(:keys, :props)
-      response = http.get(200, prefix, escape(name), options, {})
+      response = http.get(200, prefix, escape(name), {:keys => false}.merge(options), {})
       Bucket.new(self, name).load(response)
     end
     alias :[] :bucket

riak-client/spec/riak/client_spec.rb

-# Copyright 2010 Sean Cribbs, Sonian Inc., and Basho Technologies, Inc.
+60# Copyright 2010 Sean Cribbs, Sonian Inc., and Basho Technologies, Inc.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License");
 #    you may not use this file except in compliance with the License.
     end
 
     it "should send a GET request to the bucket name and return a Riak::Bucket" do
-      @http.should_receive(:get).with(200, "/riak/", "foo", {}, {}).and_return(@payload)
+      @http.should_receive(:get).with(200, "/riak/", "foo", {:keys => false}, {}).and_return(@payload)
       @client.bucket("foo").should be_kind_of(Riak::Bucket)
     end
 
-    it "should allow requesting bucket properties without the keys" do
-      @http.should_receive(:get).with(200, "/riak/", "foo", {:keys => false}, {}).and_return(@payload)
-      @client.bucket("foo", :keys => false)
+    it "should allow requesting bucket properties with the keys" do
+      @http.should_receive(:get).with(200, "/riak/", "foo", {:keys => true}, {}).and_return(@payload)
+      @client.bucket("foo", :keys => true)
     end
 
     it "should escape bucket names with invalid characters" do
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.