Commit 0b5cb703 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '337010-move-attributes-js-group-runners-to-a-helper-that-can-be-tested' into 'master'

Define group runners attributes helper

See merge request gitlab-org/gitlab!68864
parents a0c2636e 2bec7e60
......@@ -65,6 +65,15 @@ module Ci
}
end
def group_runners_data_attributes(group)
{
registration_token: group.runners_token,
group_id: group.id,
group_full_path: group.full_path,
runner_install_help_page: 'https://docs.gitlab.com/runner/install/'
}
end
def toggle_shared_runners_settings_data(project)
{
is_enabled: "#{project.shared_runners_enabled?}",
......
......@@ -3,4 +3,4 @@
%h2.page-title
= s_('Runners|Group Runners')
#js-group-runners{ data: { registration_token: @group.runners_token, runner_install_help_page: 'https://docs.gitlab.com/runner/install/', group_id: @group.id, group_full_path: @group.full_path, group_runners_limited_count: @group_runners_limited_count } }
#js-group-runners{ data: group_runners_data_attributes(@group).merge( { group_runners_limited_count: @group_runners_limited_count } ) }
......@@ -88,6 +88,19 @@ RSpec.describe Ci::RunnersHelper do
end
end
describe '#group_runners_data_attributes' do
let(:group) { create(:group) }
it 'returns group data to render a runner list' do
data = group_runners_data_attributes(group)
expect(data[:registration_token]).to eq(group.runners_token)
expect(data[:group_id]).to eq(group.id)
expect(data[:group_full_path]).to eq(group.full_path)
expect(data[:runner_install_help_page]).to eq('https://docs.gitlab.com/runner/install/')
end
end
describe '#toggle_shared_runners_settings_data' do
let_it_be(:group) { create(:group) }
......
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