Sha256: 11ecfc95776894009a9b9babbc03981240d8b863847f33189df980037fac4f57
Contents?: true
Size: 1.32 KB
Versions: 6
Compression:
Stored size: 1.32 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 "/api/source/fast_insert", :api_token => @api_token, :user_id => @u.id, :source_id => @s_fields[:name], :data => {'3' => @product3} 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 "/api/source/fast_insert", :api_token => @api_token, :user_id => @u.id, :source_id => @s_fields[:name], :data => incorrect_insert last_response.should be_ok data['3'].merge!(incorrect_insert['3']) verify_result(@s.docname(:md_size)=>'4') end end end
Version data entries
6 entries across 6 versions & 1 rubygems