Sean Cribbs avatar Sean Cribbs committed 5078072

Fix keys loading issue, add Gemfile for riak-client. Closes #39

Comments (0)

Files changed (3)

riak-client/Gemfile

+# A sample Gemfile
+source :gemcutter
+
+gem 'activesupport', '~>2.3.5'
+gem 'i18n'
+
+gem 'rspec', "~>2.0.0.beta.11"
+gem 'fakeweb', ">=1.2"
+gem 'rack', '>=1.0'
+gem 'curb', '>=0.6'
+gem 'yajl-ruby'
+gem 'rake'
+gem 'bundler'

riak-client/lib/riak/bucket.rb

           yield obj['keys'].map {|k| URI.unescape(k) } if obj['keys']
         end
       elsif @keys.nil? || options[:reload]
-        response = @client.http.get(200, @client.prefix, escape(name), {:props => false}, {})
+        response = @client.http.get(200, @client.prefix, escape(name), {:props => false, :keys => true}, {})
         load(response)
       end
       @keys

riak-client/spec/riak/bucket_spec.rb

     end
 
     it "should load the keys if not present" do
-      @http.should_receive(:get).with(200, "/riak/", "foo", {:props => false}, {}).and_return({:headers => {"content-type" => ["application/json"]}, :body => '{"keys":["bar"]}'})
+      @http.should_receive(:get).with(200, "/riak/", "foo", {:props => false, :keys => true}, {}).and_return({:headers => {"content-type" => ["application/json"]}, :body => '{"keys":["bar"]}'})
       @bucket.keys.should == ["bar"]
     end
 
     it "should allow reloading of the keys" do
-      @http.should_receive(:get).with(200, "/riak/","foo", {:props => false}, {}).and_return({:headers => {"content-type" => ["application/json"]}, :body => '{"keys":["bar"]}'})
+      @http.should_receive(:get).with(200, "/riak/","foo", {:props => false, :keys => true}, {}).and_return({:headers => {"content-type" => ["application/json"]}, :body => '{"keys":["bar"]}'})
       do_load # Ensures they're already loaded
       @bucket.keys(:reload => true).should == ["bar"]
     end
     end
 
     it "should unescape key names" do
-      @http.should_receive(:get).with(200, "/riak/","foo", {:props => false}, {}).and_return({:headers => {"content-type" => ["application/json"]}, :body => '{"keys":["bar%20baz"]}'})
+      @http.should_receive(:get).with(200, "/riak/","foo", {:props => false, :keys => true}, {}).and_return({:headers => {"content-type" => ["application/json"]}, :body => '{"keys":["bar%20baz"]}'})
       @bucket.keys.should == ["bar baz"]
     end
 
     it "should escape the bucket name" do
       @bucket.instance_variable_set :@name, "unescaped "
-      @http.should_receive(:get).with(200, "/riak/","unescaped%20", {:props => false}, {}).and_return({:headers => {"content-type" => ["application/json"]}, :body => '{"keys":["bar"]}'})
+      @http.should_receive(:get).with(200, "/riak/","unescaped%20", {:props => false, :keys => true}, {}).and_return({:headers => {"content-type" => ["application/json"]}, :body => '{"keys":["bar"]}'})
       @bucket.keys.should == ["bar"]
     end
   end
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.