Skip to content

Commit

Permalink
Pass selected workflow from AS controller to ASCreateService
Browse files Browse the repository at this point in the history
 * Allow AS controller to pass workflow_name param to service (thanks, @hortongn!)
 * Default ASCreateService to the default workflow if `nil` is passed

Fixes #3161
  • Loading branch information
mjgiarlo committed Apr 25, 2017
1 parent 6bd3530 commit 4ca3598
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/sufia/admin/admin_sets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def list_search_builder
end

def create_admin_set
AdminSetCreateService.new(@admin_set, current_user).create
AdminSetCreateService.new(@admin_set, current_user, params[:admin_set][:workflow_name]).create
end

def setup_form
Expand Down
2 changes: 1 addition & 1 deletion app/services/sufia/admin_set_create_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def self.create_default!
def initialize(admin_set, creating_user, workflow_name)
@admin_set = admin_set
@creating_user = creating_user
@workflow_name = workflow_name
@workflow_name = workflow_name || AdminSet::DEFAULT_WORKFLOW_NAME
end

attr_reader :creating_user, :admin_set, :workflow_name
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/sufia/admin/admin_sets_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
let(:service) { instance_double(Sufia::AdminSetCreateService) }
before do
allow(Sufia::AdminSetCreateService).to receive(:new)
.with(AdminSet, user)
.with(an_instance_of(AdminSet), user, nil)
.and_return(service)
end

Expand Down

0 comments on commit 4ca3598

Please sign in to comment.