Commit ed3d4003 authored by Adam Hegyi's avatar Adam Hegyi Committed by Mark Chao

Fix error when default VS is requested

This change fixes the error when the initial, in-memory default
value stream is requested.
parent 0e8208cb
...@@ -33,6 +33,12 @@ class Groups::Analytics::CycleAnalyticsController < Groups::Analytics::Applicati ...@@ -33,6 +33,12 @@ class Groups::Analytics::CycleAnalyticsController < Groups::Analytics::Applicati
def load_value_stream def load_value_stream
return unless @group && params[:value_stream_id] 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
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 ...@@ -35,6 +35,27 @@ RSpec.describe Groups::Analytics::CycleAnalyticsController do
expect(response).to render_template :show expect(response).to render_template :show
end 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 end
context 'when the license is missing' do 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