Skip to content

Commit

Permalink
Ensure 'submit_workflow' is true when adding a service to a cart
Browse files Browse the repository at this point in the history
  • Loading branch information
eclarizio committed Jul 18, 2018
1 parent be689fe commit a8049ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/api/service_orders_controller.rb
Expand Up @@ -90,7 +90,7 @@ def service_request_workflow(service_request)
raise BadRequestError, "Must specify a service_template_href for adding a service_request"
end
service_template = resource_search(service_template_id, :service_templates, ServiceTemplate)
service_template.provision_workflow(User.current_user, service_request)
service_template.provision_workflow(User.current_user, service_request, :submit_workflow => true)
end

def check_validation(validation)
Expand Down
12 changes: 12 additions & 0 deletions spec/requests/service_orders_spec.rb
Expand Up @@ -85,6 +85,18 @@
expect(response.parsed_body).to include(expected)
end

it "provisions with workflow with the correct options" do
dialog = FactoryGirl.create(:dialog, :label => "ServiceDialog1")
resource_action = FactoryGirl.create(:resource_action, :action => "Provision", :dialog => dialog)
service_template = FactoryGirl.create(:service_template, :resource_actions => [resource_action])

expect_any_instance_of(ServiceTemplate).to receive(:provision_workflow).with(@user, {}, :submit_workflow => true)

api_basic_authorize collection_action_identifier(:service_orders, :create)

post(api_service_orders_url, :params => { :service_requests => [{ :service_template_href => api_service_template_url(nil, service_template) }] })
end

specify "the default state for a service order is 'cart'" do
api_basic_authorize collection_action_identifier(:service_orders, :create)

Expand Down

0 comments on commit a8049ae

Please sign in to comment.