Sha256: e1d40a217d09742ab3fdadcd30cae845734d3f91413eeb6636d81c9b128f1aca

Contents?: true

Size: 1.09 KB

Versions: 18

Compression:

Stored size: 1.09 KB

Contents

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

describe "RhosyncApiPushObjects" do
  it_should_behave_like "ApiHelper"
  
  it "should push new objects to rhosync's :md" do
    data = {'1' => @product1, '2' => @product2, '3' => @product3}
    post "/api/push_objects", :api_token => @api_token, 
      :user_id => @u.id, :source_id => @s_fields[:name], :objects => data
    last_response.should be_ok
    verify_result(@s.docname(:md) => data,@s.docname(:md_size)=>'3')
  end
  
  it "should push updates to existing objects to rhosync's :md" do
    data = {'1' => @product1, '2' => @product2, '3' => @product3}
    update = {'price' => '0.99', 'new_field' => 'value'}
    @s = Source.load(@s_fields[:name],@s_params)
    set_state(@s.docname(:md) => data,@s.docname(:md_size) => '3')
    update.each do |key,value|
      data['2'][key] = value
    end
    post "/api/push_objects", :api_token => @api_token, 
      :user_id => @u.id, :source_id => @s_fields[:name], :objects => {'2'=>update}
    last_response.should be_ok
    verify_result(@s.docname(:md) => data,@s.docname(:md_size)=>'3')
  end
  
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rhosync-2.1.18.beta2 spec/api/push_objects_spec.rb
rhosync-2.1.18.beta1 spec/api/push_objects_spec.rb
rhosync-2.1.17 spec/api/push_objects_spec.rb
rhosync-2.1.17.beta7 spec/api/push_objects_spec.rb
rhosync-2.1.17.beta6 spec/api/push_objects_spec.rb
rhosync-2.1.17.beta5 spec/api/push_objects_spec.rb
rhosync-2.1.17.beta4 spec/api/push_objects_spec.rb
rhosync-2.1.17.beta3 spec/api/push_objects_spec.rb
rhosync-2.1.17.beta2 spec/api/push_objects_spec.rb
rhosync-2.1.17.beta1 spec/api/push_objects_spec.rb
rhosync-2.1.16 spec/api/push_objects_spec.rb
rhosync-2.1.15 spec/api/push_objects_spec.rb
rhosync-2.1.14 spec/api/push_objects_spec.rb
rhosync-2.1.13 spec/api/push_objects_spec.rb
rhosync-2.1.12 spec/api/push_objects_spec.rb
rhosync-2.1.11 spec/api/push_objects_spec.rb
rhosync-2.1.10 spec/api/push_objects_spec.rb
rhosync-2.1.7 spec/api/push_objects_spec.rb