2019-12-21 20:55:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'projects/services/_form' do
|
|
|
|
let(:project) { create(:redmine_project) }
|
|
|
|
let(:user) { create(:admin) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
assign(:project, project)
|
|
|
|
|
|
|
|
allow(controller).to receive(:current_user).and_return(user)
|
|
|
|
|
|
|
|
allow(view).to receive_messages(current_user: user,
|
|
|
|
can?: true,
|
|
|
|
current_application_settings: Gitlab::CurrentSettings.current_application_settings)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'commit_events and merge_request_events' do
|
|
|
|
before do
|
|
|
|
assign(:service, project.redmine_service)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'display merge_request_events and commit_events descriptions' do
|
|
|
|
allow(RedmineService).to receive(:supported_events).and_return(%w(commit merge_request))
|
|
|
|
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to have_content('Event will be triggered when a commit is created/updated')
|
|
|
|
expect(rendered).to have_content('Event will be triggered when a merge request is created/updated/merged')
|
|
|
|
end
|
|
|
|
|
2019-09-30 21:07:59 +05:30
|
|
|
context 'when service is Jira' do
|
2018-05-09 12:01:36 +05:30
|
|
|
let(:project) { create(:jira_project) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
assign(:service, project.jira_service)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'display merge_request_events and commit_events descriptions' do
|
|
|
|
render
|
|
|
|
|
2019-09-30 21:07:59 +05:30
|
|
|
expect(rendered).to have_content('Jira comments will be created when an issue gets referenced in a commit.')
|
|
|
|
expect(rendered).to have_content('Jira comments will be created when an issue gets referenced in a merge request.')
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|