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)
|
|
|
|
|
|
|
|
allow(view).to receive_messages(current_user: user,
|
|
|
|
can?: true,
|
2020-06-23 00:09:42 +05:30
|
|
|
current_application_settings: Gitlab::CurrentSettings.current_application_settings,
|
|
|
|
request: double(referrer: '/services'))
|
2018-05-09 12:01:36 +05:30
|
|
|
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
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(rendered).to have_css("input[name='redirect_to'][value='/services']", count: 1, visible: false)
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|