Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 3 additions & 1 deletion app/actions/manifest_route_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ def find_or_create_valid_route(app, manifest_route, user_audit_info)
manifest_triggered: true
)
elsif route.space.guid != app.space_guid
raise InvalidRoute.new('Routes cannot be mapped to destinations in different spaces')
# check if route is shared with space
spaces = route.shared_spaces
raise InvalidRoute.new('Routes cannot be mapped to destinations in different spaces') if spaces.blank? || spaces.none? { |space| space.values[:id] == app.space.id }
Comment thread
nookala marked this conversation as resolved.
Outdated
elsif manifest_route[:options] && route[:options] != manifest_route[:options]
# remove nil values from options
manifest_route[:options] = manifest_route[:options].compact
Expand Down
12 changes: 12 additions & 0 deletions spec/unit/actions/manifest_route_update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,18 @@ module VCAP::CloudController
'Routes cannot be mapped to destinations in different spaces')
end
end

context 'when the route is shared' do
let!(:route_share) { RouteShare.new }
let!(:outside_app) { AppModel.make }
let!(:shared_route) { route_share.create(route, [outside_app.space], user_audit_info) }

it 'succeeds after route share' do
expect do
ManifestRouteUpdate.update(outside_app.guid, message, user_audit_info)
end.not_to raise_error
end
end
end
end

Expand Down