Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure 'submit_workflow' is true when adding a service to a cart #426

Merged
merged 1 commit into from
Jul 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/api/service_orders_controller.rb
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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