spec/riak/map_reduce_spec.rb in riak-client-0.9.0.beta vs spec/riak/map_reduce_spec.rb in riak-client-0.9.0.beta2
- old
+ new
@@ -102,20 +102,20 @@
@mr.inputs.should == "docs"
end
it "should accept a list of key-filters along with a bucket" do
@mr.add("foo", [[:tokenize, "-", 3], [:string_to_int], [:between, 2009, 2010]])
- @mr.inputs.should == {:bucket => "foo", :filters => [[:tokenize, "-", 3], [:string_to_int], [:between, 2009, 2010]]}
+ @mr.inputs.should == {:bucket => "foo", :key_filters => [[:tokenize, "-", 3], [:string_to_int], [:between, 2009, 2010]]}
end
it "should add a bucket and filter list via a builder block" do
@mr.filter("foo") do
tokenize "-", 3
string_to_int
between 2009, 2010
end
- @mr.inputs.should == {:bucket => "foo", :filters => [[:tokenize, "-", 3], [:string_to_int], [:between, 2009, 2010]]}
+ @mr.inputs.should == {:bucket => "foo", :key_filters => [[:tokenize, "-", 3], [:string_to_int], [:between, 2009, 2010]]}
end
end
[:map, :reduce].each do |type|
describe "adding #{type} phases" do
@@ -248,22 +248,22 @@
@mr.run {|v| arr << v }
arr.should == ["foo", "bar"]
end
it "should interpret failed requests with JSON content-types as map reduce errors" do
- @backend.stub!(:mapred).and_raise(Riak::FailedRequest.new(:post, 200, 500, {"content-type" => ["application/json"]}, '{"error":"syntax error"}'))
+ @backend.stub!(:mapred).and_raise(Riak::HTTPFailedRequest.new(:post, 200, 500, {"content-type" => ["application/json"]}, '{"error":"syntax error"}'))
lambda { @mr.run }.should raise_error(Riak::MapReduceError)
begin
@mr.run
rescue Riak::MapReduceError => mre
- mre.message.should == '{"error":"syntax error"}'
+ mre.message.should include('{"error":"syntax error"}')
else
fail "No exception raised!"
end
end
it "should re-raise non-JSON error responses" do
- @backend.stub!(:mapred).and_raise(Riak::FailedRequest.new(:post, 200, 500, {"content-type" => ["text/plain"]}, 'Oops, you bwoke it.'))
+ @backend.stub!(:mapred).and_raise(Riak::HTTPFailedRequest.new(:post, 200, 500, {"content-type" => ["text/plain"]}, 'Oops, you bwoke it.'))
lambda { @mr.run }.should raise_error(Riak::FailedRequest)
end
end
end