spec/riak/stream_parser_spec.rb in riak-client-0.9.8 vs spec/riak/stream_parser_spec.rb in riak-client-1.0.0.beta

- old
+ new

@@ -1,19 +1,6 @@ -# 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -require File.expand_path("../spec_helper", File.dirname(__FILE__)) +require 'spec_helper' describe Riak::Util::Multipart::StreamParser do let(:klass) { Riak::Util::Multipart::StreamParser } let(:block) { mock } it "should detect the initial boundary" do @@ -43,11 +30,11 @@ it "should yield successive complete chunks to the block" do block.should_receive(:ping).twice.and_return(true) parser = klass.new do |result| block.ping result[:headers]['content-type'].should include("application/json") - lambda { JSON.parse(result[:body]) }.should_not raise_error + lambda { Riak::JSON.parse(result[:body]) }.should_not raise_error end File.open("spec/fixtures/multipart-mapreduce.txt", "r") do |f| while chunk = f.read(16) parser.accept chunk end @@ -57,10 +44,10 @@ it "should yield successive complete bodies to the block, even when multiple bodies are accepted in a single chunk" do block.should_receive(:ping).twice.and_return(true) parser = klass.new do |result| block.ping result[:headers]['content-type'].should include("application/json") - lambda { JSON.parse(result[:body]) }.should_not raise_error + lambda { Riak::JSON.parse(result[:body]) }.should_not raise_error end parser.accept File.read("spec/fixtures/multipart-mapreduce.txt") end end