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