summaryrefslogtreecommitdiff
path: root/spec/views/groups
diff options
context:
space:
mode:
Diffstat (limited to 'spec/views/groups')
-rw-r--r--spec/views/groups/milestones/index.html.haml_spec.rb7
-rw-r--r--spec/views/groups/runners/_sort_dropdown.html.haml_spec.rb21
-rw-r--r--spec/views/groups/show.html.haml_spec.rb118
3 files changed, 15 insertions, 131 deletions
diff --git a/spec/views/groups/milestones/index.html.haml_spec.rb b/spec/views/groups/milestones/index.html.haml_spec.rb
new file mode 100644
index 00000000000..40f175ebdc3
--- /dev/null
+++ b/spec/views/groups/milestones/index.html.haml_spec.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'groups/milestones/index.html.haml' do
+ it_behaves_like 'milestone empty states'
+end
diff --git a/spec/views/groups/runners/_sort_dropdown.html.haml_spec.rb b/spec/views/groups/runners/_sort_dropdown.html.haml_spec.rb
index 4b5027a5a56..5438fea85ee 100644
--- a/spec/views/groups/runners/_sort_dropdown.html.haml_spec.rb
+++ b/spec/views/groups/runners/_sort_dropdown.html.haml_spec.rb
@@ -4,27 +4,22 @@ require 'spec_helper'
RSpec.describe 'groups/runners/sort_dropdown.html.haml' do
describe 'render' do
- let_it_be(:sort_options_hash) { { by_title: 'Title' } }
- let_it_be(:sort_title_created_date) { 'Created date' }
-
- before do
- allow(view).to receive(:sort).and_return('by_title')
- end
-
describe 'when a sort option is not selected' do
it 'renders a default sort option' do
- render 'groups/runners/sort_dropdown', sort_options_hash: sort_options_hash, sort_title_created_date: sort_title_created_date
+ render 'groups/runners/sort_dropdown'
- expect(rendered).to have_content 'Created date'
+ expect(rendered).to have_content _('Created date')
end
end
describe 'when a sort option is selected' do
- it 'renders the selected sort option' do
- @sort = :by_title
- render 'groups/runners/sort_dropdown', sort_options_hash: sort_options_hash, sort_title_created_date: sort_title_created_date
+ before do
+ assign(:sort, 'contacted_asc')
+ render 'groups/runners/sort_dropdown'
+ end
- expect(rendered).to have_content 'Title'
+ it 'renders the selected sort option' do
+ expect(rendered).to have_content _('Last Contact')
end
end
end
diff --git a/spec/views/groups/show.html.haml_spec.rb b/spec/views/groups/show.html.haml_spec.rb
deleted file mode 100644
index 43e11d31611..00000000000
--- a/spec/views/groups/show.html.haml_spec.rb
+++ /dev/null
@@ -1,118 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe 'groups/edit.html.haml' do
- include Devise::Test::ControllerHelpers
-
- describe '"Share with group lock" setting' do
- let(:root_owner) { create(:user) }
- let(:root_group) { create(:group) }
-
- before do
- root_group.add_owner(root_owner)
- end
-
- shared_examples_for '"Share with group lock" setting' do |checkbox_options|
- it 'has the correct label, help text, and checkbox options' do
- assign(:group, test_group)
- allow(view).to receive(:can?).with(test_user, :admin_group, test_group).and_return(true)
- allow(view).to receive(:can_change_group_visibility_level?).and_return(false)
- allow(view).to receive(:current_user).and_return(test_user)
- expect(view).to receive(:can_change_share_with_group_lock?).and_return(!checkbox_options[:disabled])
- expect(view).to receive(:share_with_group_lock_help_text).and_return('help text here')
-
- render
-
- expect(rendered).to have_content("Prevent sharing a project within #{test_group.name} with other groups")
- expect(rendered).to have_content('help text here')
- expect(rendered).to have_field('group_share_with_group_lock', **checkbox_options)
- end
- end
-
- context 'for a root group' do
- let(:test_group) { root_group }
- let(:test_user) { root_owner }
-
- it_behaves_like '"Share with group lock" setting', { disabled: false, checked: false }
- end
-
- context 'for a subgroup' do
- let!(:subgroup) { create(:group, parent: root_group) }
- let(:sub_owner) { create(:user) }
- let(:test_group) { subgroup }
-
- context 'when the root_group has "Share with group lock" disabled' do
- context 'when the subgroup has "Share with group lock" disabled' do
- context 'as the root_owner' do
- let(:test_user) { root_owner }
-
- it_behaves_like '"Share with group lock" setting', { disabled: false, checked: false }
- end
-
- context 'as the sub_owner' do
- let(:test_user) { sub_owner }
-
- it_behaves_like '"Share with group lock" setting', { disabled: false, checked: false }
- end
- end
-
- context 'when the subgroup has "Share with group lock" enabled' do
- before do
- subgroup.update_column(:share_with_group_lock, true)
- end
-
- context 'as the root_owner' do
- let(:test_user) { root_owner }
-
- it_behaves_like '"Share with group lock" setting', { disabled: false, checked: true }
- end
-
- context 'as the sub_owner' do
- let(:test_user) { sub_owner }
-
- it_behaves_like '"Share with group lock" setting', { disabled: false, checked: true }
- end
- end
- end
-
- context 'when the root_group has "Share with group lock" enabled' do
- before do
- root_group.update_column(:share_with_group_lock, true)
- end
-
- context 'when the subgroup has "Share with group lock" disabled (parent overridden)' do
- context 'as the root_owner' do
- let(:test_user) { root_owner }
-
- it_behaves_like '"Share with group lock" setting', { disabled: false, checked: false }
- end
-
- context 'as the sub_owner' do
- let(:test_user) { sub_owner }
-
- it_behaves_like '"Share with group lock" setting', { disabled: false, checked: false }
- end
- end
-
- context 'when the subgroup has "Share with group lock" enabled (same as parent)' do
- before do
- subgroup.update_column(:share_with_group_lock, true)
- end
-
- context 'as the root_owner' do
- let(:test_user) { root_owner }
-
- it_behaves_like '"Share with group lock" setting', { disabled: false, checked: true }
- end
-
- context 'as the sub_owner' do
- let(:test_user) { sub_owner }
-
- it_behaves_like '"Share with group lock" setting', { disabled: true, checked: true }
- end
- end
- end
- end
- end
-end