Commit f0d12cca authored by Justin Ho's avatar Justin Ho

Add basic controller specs

- For format.html to make sure instance variable is set
and template is rendered.
- Also add the scenario when the feature flag is not
enabled.
- Update translations
parent 57b8567c
......@@ -17656,6 +17656,9 @@ msgstr ""
msgid "Integrations|Note: this integration only works with accounts on GitLab.com (SaaS)."
msgstr ""
msgid "Integrations|Projects using custom settings"
msgstr ""
msgid "Integrations|Projects using custom settings will not be affected."
msgstr ""
......
......@@ -105,17 +105,44 @@ RSpec.describe Admin::IntegrationsController do
let_it_be(:overridden_other_integration) { create(:confluence_integration) }
subject do
get :overrides, params: { id: instance_integration.class.to_param }, format: :json
get :overrides, params: { id: instance_integration.class.to_param }, format: format
end
include_context 'JSON response'
context 'when format is HTML' do
let(:format) { :json }
it 'returns projects with overrides', :aggregate_failures do
subject
include_context 'JSON response'
expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers
expect(json_response).to contain_exactly(a_hash_including('full_name' => overridden_integration.project.full_name))
it 'returns projects with overrides', :aggregate_failures do
subject
expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers
expect(json_response).to contain_exactly(a_hash_including('full_name' => overridden_integration.project.full_name))
end
end
context 'when format is HTML' do
let(:format) { :html }
it 'renders template' do
subject
expect(response).to render_template 'shared/integrations/overrides'
expect(assigns(:integration)).to eq(instance_integration)
end
context 'when `instance_level_integration_overrides` is not enabled' do
before do
stub_feature_flags(instance_level_integration_overrides: false)
end
it 'renders a 404' do
subject
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
end
end
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