Skip to content

Commit

Permalink
Update bs request factory for staging projects
Browse files Browse the repository at this point in the history
Ensure that packages of staged requests are getting copied to the
staging project.
  • Loading branch information
bgeuken committed Apr 1, 2019
1 parent 7833c0a commit 109877b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/api/spec/factories/bs_requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,21 @@
raise 'Do not pass a string as creator' if evaluator.creator.is_a?(String)
end

after(:create) do |request, evaluator|
next unless request.staging_project && evaluator.staging_owner

User.current = evaluator.staging_owner
request.bs_request_actions.where(type: :submit).each do |action|
BranchPackage.new(
project: action.source_project,
package: action.source_package,
target_project: request.staging_project.name,
target_package: action.target_package
).branch
end
User.current = evaluator.before_current_user
end

transient do
type { nil }
source_project { nil }
Expand All @@ -77,6 +92,7 @@
review_by_group { nil }
review_by_project { nil }
review_by_package { nil }
staging_owner { nil }
creating_user do |evaluator|
evaluator.creator.is_a?(User) ? evaluator.creator : User.find_by_login(evaluator.creator)
end
Expand Down

0 comments on commit 109877b

Please sign in to comment.