debian-mirror-gitlab/spec/helpers/groups/settings_helper_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
1.1 KiB
Ruby
Raw Normal View History

2021-12-11 22:18:48 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Groups::SettingsHelper do
include GroupsHelper
let_it_be(:group) { create(:group, path: "foo") }
describe('#group_settings_confirm_modal_data') do
using RSpec::Parameterized::TableSyntax
fake_form_id = "fake_form_id"
2023-03-04 22:38:38 +05:30
where(:prevent_delete_response, :is_button_disabled, :form_value_id) do
2021-12-11 22:18:48 +05:30
true | "true" | nil
true | "true" | fake_form_id
false | "false" | nil
false | "false" | fake_form_id
end
with_them do
it "returns expected parameters" do
2023-03-04 22:38:38 +05:30
allow(group).to receive(:prevent_delete?).and_return(prevent_delete_response)
2021-12-11 22:18:48 +05:30
expected = helper.group_settings_confirm_modal_data(group, form_value_id)
expect(expected).to eq({
button_text: "Remove group",
confirm_danger_message: remove_group_message(group),
remove_form_id: form_value_id,
phrase: group.full_path,
button_testid: "remove-group-button",
disabled: is_button_disabled
})
end
end
end
end