Class: TestCaseCopy

Inherits:
ObjectCopy show all
Defined in:
lib/translate/copy/test_case_copy.rb

Instance Method Summary collapse

Methods inherited from ObjectCopy

#card_values, #copy, #create_object, #excluded_attributes, #fetch_object, #fetch_project, #find_project_in_new_workspace, #initialize, #logger, #new_workspace, #rally_rest, #remember, #shallow_copy, #type_as_symbol, #user_exists?

Constructor Details

This class inherits a constructor from ObjectCopy

Instance Method Details

#copy_childrenObject



3
4
5
6
7
8
9
10
11
# File 'lib/translate/copy/test_case_copy.rb', line 3

def copy_children
  @object.results.each do |result|
    result.copy(new_workspace, :test_case => @new_object)
  end unless @object.results.nil?

  @object.steps.each do |step|
    step.copy(new_workspace, :test_case => @new_object)
  end unless @object.steps.nil?
end

#tangleObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/translate/copy/test_case_copy.rb', line 13

def tangle
  super

  if @new_object.nil?
    logger.debug "Could not find new object for object #{@object.oid} -- #{@object.name}"
    return
  end

  values = {}
  if  !@object.work_product.nil? 
    # get the new work product copied from this testcase
    new_work_product = fetch_object(:artifact, @object.work_product.oid)
    values[:work_product] = new_work_product
    # update the new test case
    @new_object.update(values) unless values.length == 0
  end
end