Sha256: 90a6c4f2c663e5c14cb2ab729f0a61a90163f4bf9d80ce8db9ad3b21305a26a4
Contents?: true
Size: 1.37 KB
Versions: 13
Compression:
Stored size: 1.37 KB
Contents
require File.join(File.dirname(__FILE__),'..','api_helper') describe "RhoconnectApiFastInsert" do it_should_behave_like "ApiHelper" do it "should append new objects to rhoconnect's :md" do data = {'1' => @product1, '2' => @product2} @s = Source.load(@s_fields[:name],@s_params) set_state(@s.docname(:md) => data,@s.docname(:md_size) => '2') post "/app/#{Rhoconnect::API_VERSION}/#{@s_fields[:name]}/fast_insert", {:user_id => @u.id, :data => {'3' => @product3}}, {Rhoconnect::API_TOKEN_HEADER => @api_token} last_response.should be_ok data.merge!({'3' => @product3}) verify_result(@s.docname(:md) => data,@s.docname(:md_size)=>'3') end it "should incorrectly append data to existing object (because fast_insert doesn't ensure any data integrity)" do data = {'1' => @product1, '2' => @product2, '3' => @product3} incorrect_insert = {'3' => {'price' => '1.99', 'new_field' => 'value'}} @s = Source.load(@s_fields[:name],@s_params) set_state(@s.docname(:md) => data,@s.docname(:md_size) => '3') post "/app/#{Rhoconnect::API_VERSION}/#{@s_fields[:name]}/fast_insert", {:user_id => @u.id, :data => incorrect_insert}, {Rhoconnect::API_TOKEN_HEADER => @api_token} last_response.should be_ok data['3'].merge!(incorrect_insert['3']) verify_result(@s.docname(:md_size)=>'4') end end end
Version data entries
13 entries across 13 versions & 1 rubygems