Commit beba9e68 authored by Mark Chao's avatar Mark Chao

Merge branch '324673-fix-error-on-default-vsa-page' into 'master'

Fix error when default VS is requested

See merge request gitlab-org/gitlab!56761
parents 7546a4ba ed3d4003
......@@ -33,6 +33,12 @@ class Groups::Analytics::CycleAnalyticsController < Groups::Analytics::Applicati
def load_value_stream
return unless @group && params[:value_stream_id]
@value_stream = @group.value_streams.find(params[:value_stream_id])
default_name = Analytics::CycleAnalytics::Stages::BaseService::DEFAULT_VALUE_STREAM_NAME
@value_stream = if params[:value_stream_id] == default_name
@group.value_streams.new(name: default_name)
else
@group.value_streams.find(params[:value_stream_id])
end
end
end
---
title: Fix 500 error when refreshing Value Stream Analytics page with a default stage
merge_request: 56761
author:
type: fixed
......@@ -35,6 +35,27 @@ RSpec.describe Groups::Analytics::CycleAnalyticsController do
expect(response).to render_template :show
end
context 'when the initial, default value stream is requested' do
let(:value_stream_id) { Analytics::CycleAnalytics::Stages::BaseService::DEFAULT_VALUE_STREAM_NAME }
before do
get(:show, params: { group_id: group, value_stream_id: value_stream_id })
end
it 'renders the default in memory value stream' do
expect(response).to have_gitlab_http_status(:ok)
expect(assigns[:value_stream].name).to eq(value_stream_id)
end
context 'when invalid name is given' do
let(:value_stream_id) { 'not_default' }
it 'renders 404 error' do
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
end
context 'when the license is missing' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment