Sha256: 1c2397a7953cae6bdaeb1562268dd9a7c63f005ae25e8bccd2838b6579499459

Contents?: true

Size: 1.19 KB

Versions: 8

Compression:

Stored size: 1.19 KB

Contents

shared_examples "object" do 
  | update |
  it 'can get info' do
    result = subject.info
    is_success( result )
  end

  it 'can update it self' do
    result = subject.update(  update )
    is_success( result )
  end
end

# 在这之前要describ object
shared_examples "object operator" do 
  |object_name,  add_info, update_info |
  object_id = 0
  
  it 'can add object' do
    method_name = "add_"+object_name
    result = subject.send( method_name.to_sym, add_info )
    is_success( result )
    object_id = result[:result][0][:id]
  end

  it 'can update object' do
    method_name = "update_"+object_name
    result = subject.send( method_name.to_sym, update_info.merge( {id:object_id} ) )
    is_success( result )
  end

  it 'can delete object' do
    method_name = "delete_"+object_name
    result = subject.send( method_name.to_sym, object_id )
    is_success( result )
  end
end

  shared_examples "object parent" do
    | object_name| 
    it 'can get all objects'do
      result = subject.send( (object_name + 's').to_sym ) 
      is_success( result )
    end 

    it 'can get all object ids' do
      result = subject.send( (object_name + '_ids').to_sym ) 
      is_success( result )
    end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ppc-2.0.5 spec/operation/operation_spec_helper.rb
ppc-2.0.4 spec/operation/operation_spec_helper.rb
ppc-2.0.3 spec/operation/operation_spec_helper.rb
ppc-2.0.2 spec/operation/operation_spec_helper.rb
ppc-2.0.1 spec/operation/operation_spec_helper.rb
ppc-2.0.0 spec/operation/operation_spec_helper.rb
ppc-1.3.2 spec/operation/operation_spec_helper.rb
ppc-0.3.0 spec/operation/operation_spec_helper.rb