myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [3772] trunk: Creating a new component version no


From: noreply
Subject: [myexperiment-hackers] [3772] trunk: Creating a new component version no longer returns version 1 of the component in the response
Date: Tue, 5 Nov 2013 09:40:04 +0000 (UTC)

Revision
3772
Author
fbacall
Date
2013-11-05 09:40:04 +0000 (Tue, 05 Nov 2013)

Log Message

Creating a new component version no longer returns version 1 of the component in the response

Modified Paths

Diff

Modified: trunk/lib/api/resources/components.rb (3771 => 3772)


--- trunk/lib/api/resources/components.rb	2013-11-05 09:00:39 UTC (rev 3771)
+++ trunk/lib/api/resources/components.rb	2013-11-05 09:40:04 UTC (rev 3772)
@@ -104,8 +104,9 @@
   # Create the component or version
   response = workflow_aux('create', opts)
 
-  # If we created a new component, we need to tag it and add it to the family
-  unless id
+  if id # Reload the component to get the latest version
+    component = component.reload
+  else # If we created a new component, we need to tag it and add it to the family
     # Awful hack to get the newly created component
     component = resource_from_uri(response[:xml].find_first('//workflow')['resource'])
 

Modified: trunk/test/functional/api_controller_test.rb (3771 => 3772)


--- trunk/test/functional/api_controller_test.rb	2013-11-05 09:00:39 UTC (rev 3771)
+++ trunk/test/functional/api_controller_test.rb	2013-11-05 09:40:04 UTC (rev 3772)
@@ -1275,6 +1275,10 @@
     uri = workflow_resp.find_first('//workflow')['resource']
     component = Workflow.find(uri.split('/').last.to_i)
 
+    # Check the response body contains the updated metadata
+    assert_equal "2", workflow_resp.find_first('//workflow')['version']
+    assert_equal 'Test Component II', workflow_resp.find_first('//title/text()').to_s
+
     # Check the version was created
     assert_equal version_count+1, WorkflowVersion.count
     assert_equal 'Test Component II', component.title

reply via email to

[Prev in Thread] Current Thread [Next in Thread]