diff options
Diffstat (limited to 'spec/views/admin/groups/_form.html.haml_spec.rb')
-rw-r--r-- | spec/views/admin/groups/_form.html.haml_spec.rb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/views/admin/groups/_form.html.haml_spec.rb b/spec/views/admin/groups/_form.html.haml_spec.rb new file mode 100644 index 00000000000..87929571a84 --- /dev/null +++ b/spec/views/admin/groups/_form.html.haml_spec.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'admin/groups/_form', feature_category: :subgroups do + using RSpec::Parameterized::TableSyntax + + let_it_be(:admin) { build(:user, :admin) } + let_it_be(:group) { build(:group, namespace_settings: build(:namespace_settings)) } + + before do + allow(view).to receive(:current_user).and_return(admin) + allow(view).to receive(:visibility_level).and_return(group.visibility_level) + assign(:group, group) + end + + describe 'group runner registration setting' do + where(:runner_registration_enabled, :valid_runner_registrars, :checked, :disabled) do + true | ['group'] | true | false + false | ['group'] | false | false + false | ['project'] | false | true + end + + with_them do + before do + allow(group).to receive(:runner_registration_enabled?).and_return(runner_registration_enabled) + stub_application_setting(valid_runner_registrars: valid_runner_registrars) + end + + it 'renders the checkbox correctly' do + render + + expect(rendered).to have_field( + 'New group runners can be registered', + type: 'checkbox', + checked: checked, + disabled: disabled + ) + end + end + end +end |