Method: Rhoconnect::TestMethods#test_create

Defined in:
lib/rhoconnect/test_methods.rb

#test_create(record) ⇒ Object

Execute’s the adapter’s create method with a provided record and returns the object string from the create method. If the create method returns a string, then a link will be saved for the device next time it synchronizes. This link can be tested here.

For example, in your spec: } new_product_id = test_create(@product) create_errors.should == {} md.should == @product

This will return the result of the adapter’s create method. The master document (:md) should also contain the new record.



162
163
164
165
166
167
168
169
170
171
172
# File 'lib/rhoconnect/test_methods.rb', line 162

def test_create(record)
  if @s.is_pass_through?
    @cud_engine.params = {'create'=> {'temp-id' => record}}
    @cud_engine.do_pass_through_cud
  else
    @s.push_queue("create:post:/",@c.id,[[@s.name,[['temp-id', record]]]],true)
    @cud_engine.do_cud
    links = @c.get_data(:create_links)['temp-id']
    links ? links['l'] : nil
  end
end