Sha256: e58d7687563463314b95e484c62b55d8ccb400aa056df740bed3443ba599b41a

Contents?: true

Size: 1.69 KB

Versions: 13

Compression:

Stored size: 1.69 KB

Contents

require File.join(File.dirname(__FILE__),'spec_helper')

describe "Document" do
  it_behaves_like "SharedRhoconnectHelper", :rhoconnect_data => true do
    before(:each) do
      @s = Source.load(@s_fields[:name],@s_params)
    end
    
    it "should generate client docname" do
      @c.docname(:foo).should == "client:#{@a.id}:#{@u.id}:#{@c.id}:#{@s_fields[:name]}:foo"
    end

    it "should generate source docname" do
      @s.docname(:foo).should == "source:#{@a.id}:#{@u.id}:#{@s_fields[:name]}:foo"
    end

    it "should flash_data for docname" do
      @c.put_data(:foo1,{'1'=>@product1})
      docname = @c.docname(:foo1)
      bucket_index = get_sha1('1')[0..1]
      Store.db.keys(@c.docname('*')).sort.should == ["#{docname}:#{bucket_index}", "#{docname}:indices"].sort
      @c.flash_data('*')
      Store.db.keys(@c.docname(:foo)).should == []
    end
    
    it "should flash_data for arrays" do
      @c.put_list(:foo1,['1', '2', '3'])
      Store.db.keys(@c.docname('*')).should == [@c.docname(:foo1)]
      @c.flash_data('*')
      Store.db.keys(@c.docname(:foo)).should == []
    end
    
    it "should get_data for arrays" do
      @c.put_list(:foo1,['1', '2', '3'])
      Store.db.keys(@c.docname('*')).should == [@c.docname(:foo1)]
      @c.get_data(:foo1, Array).should == ['1', '2', '3']
    end

    it "should rename doc" do
      set_state(@c.docname(:key1) => @data)
      @c.rename(:key1,:key2)
      verify_result(@c.docname(:key1) => {}, @c.docname(:key2) => @data)
    end
    
    it "should operate with individual object" do
      key = '1'
      data = {'foo' => 'bar'}
      @c.put_object(:md, key, data)
      obj = @c.get_object(:md, key)
      obj.should == data
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rhoconnect-3.4.5 spec/document_spec.rb
rhoconnect-3.4.4 spec/document_spec.rb
rhoconnect-3.4.3 spec/document_spec.rb
rhoconnect-3.4.2 spec/document_spec.rb
rhoconnect-3.3.6 spec/document_spec.rb
rhoconnect-3.3.5 spec/document_spec.rb
rhoconnect-3.3.4 spec/document_spec.rb
rhoconnect-3.3.3 spec/document_spec.rb
rhoconnect-3.3.2 spec/document_spec.rb
rhoconnect-3.3.1 spec/document_spec.rb
rhoconnect-3.3.1.beta4 spec/document_spec.rb
rhoconnect-3.3.1.beta3 spec/document_spec.rb
rhoconnect-3.3.1.beta2 spec/document_spec.rb