2019-12-21 20:55:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe 'projects/services/_form' do
|
2018-05-09 12:01:36 +05:30
|
|
|
let(:project) { create(:redmine_project) }
|
|
|
|
let(:user) { create(:admin) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
assign(:project, project)
|
|
|
|
|
|
|
|
allow(controller).to receive(:current_user).and_return(user)
|
|
|
|
|
2021-09-04 01:27:46 +05:30
|
|
|
allow(view).to receive_messages(
|
|
|
|
current_user: user,
|
|
|
|
can?: true,
|
|
|
|
current_application_settings: Gitlab::CurrentSettings.current_application_settings,
|
2021-09-30 23:02:18 +05:30
|
|
|
integration: project.redmine_integration,
|
2021-09-04 01:27:46 +05:30
|
|
|
request: double(referer: '/services')
|
|
|
|
)
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|
|
|
|
|
2022-03-02 08:16:31 +05:30
|
|
|
context 'integrations form' do
|
|
|
|
it 'does not render form element' do
|
2018-05-09 12:01:36 +05:30
|
|
|
render
|
|
|
|
|
2022-03-02 08:16:31 +05:30
|
|
|
expect(rendered).not_to have_selector('[data-testid="integration-form"]')
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when vue_integration_form feature flag is disabled' do
|
|
|
|
before do
|
|
|
|
stub_feature_flags(vue_integration_form: false)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'renders form element' do
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to have_selector('[data-testid="integration-form"]')
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'commit_events and merge_request_events' do
|
|
|
|
it 'display merge_request_events and commit_events descriptions' do
|
|
|
|
allow(Integrations::Redmine).to receive(:supported_events).and_return(%w(commit merge_request))
|
|
|
|
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to have_css("input[name='redirect_to'][value='/services']", count: 1, visible: false)
|
|
|
|
end
|
|
|
|
end
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|