Sha256: 12c26492172eb69032441778817b821aca360e530e4cdbbce1f3d367e001a4fc

Contents?: true

Size: 1.79 KB

Versions: 23

Compression:

Stored size: 1.79 KB

Contents

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

describe "Client" do
  it_should_behave_like "SpecBootstrapHelper"
  it_should_behave_like "SourceAdapterHelper"
  
  it "should create client with fields" do
    @c.id.length.should == 32
    @c.device_type.should == @c_fields[:device_type]
  end
  
  it "should update_fields for a client" do
    @c.update_fields({:device_type => 'android',:device_port => 100})
    @c.device_type.should == 'android'
    @c.device_port.should == '100'
  end
  
  it "should create client with user_id" do
    @c.id.length.should == 32
    @c.user_id.should == @c_fields[:user_id]
    @u.clients.members.should == [@c.id]
  end
  
  it "should raise exception if source_name is nil" do
    @c.source_name = nil
    lambda { 
      @c.doc_suffix('foo') 
    }.should raise_error(InvalidSourceNameError, 'Invalid Source Name For Client')
  end
  
  it "should raise exception if license seats exceeded" do
    Store.put_value(License::CLIENT_DOCKEY,100)
    lambda { Client.create(@c_fields,{}) }.should raise_error(
      LicenseSeatsExceededException, "WARNING: Maximum # of devices exceeded for this license."
    )
  end
  
  it "should free seat when client is deleted" do
    current = Store.get_value(License::CLIENT_DOCKEY).to_i
    @c.delete
    Store.get_value(License::CLIENT_DOCKEY).to_i.should == current - 1
  end

  it "should delete client and all associated documents" do
    docname = @c.docname(:cd)
    set_state(docname => @data)    
    @c.delete
    verify_result(docname => {})
  end
  
  it "should create cd as masterdoc clone" do
    set_state(@s.docname(:md_copy) => @data,
      @c.docname(:cd) => {'foo' => {'bar' => 'abc'}})
    @c.update_clientdoc([@s_fields[:name]])
    verify_result(@c.docname(:cd) => @data,
      @s.docname(:md_copy) => @data)
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
rhosync-2.0.9 spec/client_spec.rb
rhosync-2.0.8 spec/client_spec.rb
rhosync-2.0.7 spec/client_spec.rb
rhosync-2.0.6 spec/client_spec.rb
rhosync-2.0.5 spec/client_spec.rb
rhosync-2.0.4 spec/client_spec.rb
rhosync-2.0.3 spec/client_spec.rb
rhosync-2.0.2 spec/client_spec.rb
rhosync-2.0.1 spec/client_spec.rb
rhosync-2.0.0 spec/client_spec.rb
rhosync-2.0.0.rc2 spec/client_spec.rb
rhosync-2.0.0.rc1 spec/client_spec.rb
rhosync-2.0.0.beta13 spec/client_spec.rb
rhosync-2.0.0.beta12 spec/client_spec.rb
rhosync-2.0.0.beta11 spec/client_spec.rb
rhosync-2.0.0.beta10 spec/client_spec.rb
rhosync-2.0.0.beta9 spec/client_spec.rb
rhosync-2.0.0.beta8 spec/client_spec.rb
rhosync-2.0.0.beta7 spec/client_spec.rb
rhosync-2.0.0.beta6 spec/client_spec.rb