Sha256: 793579746207174dcb5f88b8d62deb20bc9f0f57750bc7acdbf891cc7fd2d362

Contents?: true

Size: 979 Bytes

Versions: 26

Compression:

Stored size: 979 Bytes

Contents

require 'spec_helper'

describe Riak::Util::Multipart do
  it "should extract the boundary string from a header value" do
    Riak::Util::Multipart.extract_boundary("multipart/mixed; boundary=123446677890").should == "123446677890"
  end

  it "should parse an empty multipart body into empty arrays" do
    data = File.read(File.expand_path("#{File.dirname(__FILE__)}/../fixtures/multipart-blank.txt"))
    Riak::Util::Multipart.parse(data, "73NmmA8dJxSB5nL2dVerpFIi8ze").should == [[]]
  end

  it "should parse multipart body into nested arrays with response-like results" do
    data = File.read(File.expand_path("#{File.dirname(__FILE__)}/../fixtures/multipart-with-body.txt"))
    results = Riak::Util::Multipart.parse(data, "5EiMOjuGavQ2IbXAqsJPLLfJNlA")
    results.should be_kind_of(Array)
    results.first.should be_kind_of(Array)
    obj = results.first.first
    obj.should be_kind_of(Hash)
    obj.should have_key(:headers)
    obj.should have_key(:body)
  end
end

Version data entries

26 entries across 16 versions & 2 rubygems

Version Path
riak-client-1.4.5 spec/riak/multipart_spec.rb
riak-client-1.4.4.1 spec/riak/multipart_spec.rb
riak-client-1.4.4 spec/riak/multipart_spec.rb
riak-client-1.4.3 spec/riak/multipart_spec.rb
riak-client-1.4.2 spec/riak/multipart_spec.rb
riak-client-1.4.1 spec/riak/multipart_spec.rb
riak-client-1.4.0 spec/riak/multipart_spec.rb
riak-client-1.2.0 spec/riak/multipart_spec.rb
riak-client-1.1.1 spec/riak/multipart_spec.rb
riak-client-1.1.0 spec/riak/multipart_spec.rb
riak-client-1.0.5 spec/riak/multipart_spec.rb
riak-client-1.0.3 pkg/riak-client-1.0.2/pkg/riak-client-1.0.1/spec/riak/multipart_spec.rb
riak-client-1.0.3 pkg/riak-client-1.0.2/spec/riak/multipart_spec.rb
riak-client-1.0.3 spec/riak/multipart_spec.rb
riak-client-1.0.3 pkg/riak-client-1.0.1/pkg/riak-client-1.0.0/spec/riak/multipart_spec.rb
riak-client-1.0.3 pkg/riak-client-1.0.0/spec/riak/multipart_spec.rb
riak-client-1.0.3 pkg/riak-client-1.0.1/spec/riak/multipart_spec.rb
riak-client-1.0.3 pkg/riak-client-1.0.2/pkg/riak-client-1.0.0/spec/riak/multipart_spec.rb
riak-client-1.0.3 pkg/riak-client-1.0.2/pkg/riak-client-1.0.1/pkg/riak-client-1.0.0/spec/riak/multipart_spec.rb
riak-client-1.0.2 pkg/riak-client-1.0.0/spec/riak/multipart_spec.rb