diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-27 15:09:41 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-27 15:09:41 +0300 |
commit | 0a559c913e4d333f339fcc03b89bfeade9ca0b93 (patch) | |
tree | 12175c0e0b5b97a72250acb8261d1c2512ef6bae /spec | |
parent | ef96d56ed3c723ac913ea4d8ab6504043f849555 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/projects/issues_controller_spec.rb | 26 | ||||
-rw-r--r-- | spec/frontend/issues_list/components/issues_list_app_spec.js | 2 | ||||
-rw-r--r-- | spec/frontend/issues_list/mock_data.js | 40 | ||||
-rw-r--r-- | spec/frontend/issues_list/utils_spec.js | 8 | ||||
-rw-r--r-- | spec/frontend/vue_mr_widget/mr_widget_options_spec.js | 5 | ||||
-rw-r--r-- | spec/frontend/vue_mr_widget/test_extension.js | 1 | ||||
-rw-r--r-- | spec/frontend/vue_shared/components/filtered_search_bar/mock_data.js | 9 | ||||
-rw-r--r-- | spec/frontend/vue_shared/components/filtered_search_bar/tokens/release_token_spec.js | 78 | ||||
-rw-r--r-- | spec/helpers/issues_helper_spec.rb | 1 | ||||
-rw-r--r-- | spec/lib/gitlab/metrics/samplers/action_cable_sampler_spec.rb | 68 | ||||
-rw-r--r-- | spec/lib/gitlab/runtime_spec.rb | 22 | ||||
-rw-r--r-- | spec/serializers/service_field_entity_spec.rb | 2 | ||||
-rw-r--r-- | spec/services/issues/update_service_spec.rb | 42 | ||||
-rw-r--r-- | spec/tooling/danger/changelog_spec.rb | 4 |
14 files changed, 204 insertions, 104 deletions
diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index 0b3bd4d78ac..382ce0feda0 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -1084,28 +1084,30 @@ RSpec.describe Projects::IssuesController do end context 'real-time sidebar feature flag' do - using RSpec::Parameterized::TableSyntax - let_it_be(:project) { create(:project, :public) } let_it_be(:issue) { create(:issue, project: project) } - where(:action_cable_in_app_enabled, :feature_flag_enabled, :gon_feature_flag) do - true | true | true - true | false | true - false | true | true - false | false | false + context 'when enabled' do + before do + stub_feature_flags(real_time_issue_sidebar: true) + end + + it 'pushes the correct value to the frontend' do + go(id: issue.to_param) + + expect(Gon.features).to include('realTimeIssueSidebar' => true) + end end - with_them do + context 'when disabled' do before do - expect(Gitlab::ActionCable::Config).to receive(:in_app?).and_return(action_cable_in_app_enabled) - stub_feature_flags(real_time_issue_sidebar: feature_flag_enabled) + stub_feature_flags(real_time_issue_sidebar: false) end - it 'broadcasts to the issues channel based on ActionCable and feature flag values' do + it 'pushes the correct value to the frontend' do go(id: issue.to_param) - expect(Gon.features).to include('realTimeIssueSidebar' => gon_feature_flag) + expect(Gon.features).to include('realTimeIssueSidebar' => false) end end end diff --git a/spec/frontend/issues_list/components/issues_list_app_spec.js b/spec/frontend/issues_list/components/issues_list_app_spec.js index 6b443062f12..3f52c7b4afe 100644 --- a/spec/frontend/issues_list/components/issues_list_app_spec.js +++ b/spec/frontend/issues_list/components/issues_list_app_spec.js @@ -37,6 +37,7 @@ import { TOKEN_TYPE_LABEL, TOKEN_TYPE_MILESTONE, TOKEN_TYPE_MY_REACTION, + TOKEN_TYPE_RELEASE, TOKEN_TYPE_TYPE, TOKEN_TYPE_WEIGHT, urlSortParams, @@ -581,6 +582,7 @@ describe('IssuesListApp component', () => { { type: TOKEN_TYPE_MILESTONE }, { type: TOKEN_TYPE_LABEL }, { type: TOKEN_TYPE_TYPE }, + { type: TOKEN_TYPE_RELEASE }, { type: TOKEN_TYPE_MY_REACTION }, { type: TOKEN_TYPE_CONFIDENTIAL }, { type: TOKEN_TYPE_ITERATION }, diff --git a/spec/frontend/issues_list/mock_data.js b/spec/frontend/issues_list/mock_data.js index c62050c3563..25664cc2842 100644 --- a/spec/frontend/issues_list/mock_data.js +++ b/spec/frontend/issues_list/mock_data.js @@ -95,12 +95,18 @@ export const locationSearch = [ 'assignee_username[]=lisa', 'not[assignee_username][]=patty', 'not[assignee_username][]=selma', + 'milestone_title=season+3', 'milestone_title=season+4', 'not[milestone_title]=season+20', + 'not[milestone_title]=season+30', 'label_name[]=cartoon', 'label_name[]=tv', 'not[label_name][]=live action', 'not[label_name][]=drama', + 'release_tag=v3', + 'release_tag=v4', + 'not[release_tag]=v20', + 'not[release_tag]=v30', 'type[]=issue', 'type[]=feature', 'not[type][]=bug', @@ -109,7 +115,9 @@ export const locationSearch = [ 'not[my_reaction_emoji]=thumbsdown', 'confidential=yes', 'iteration_id=4', + 'iteration_id=12', 'not[iteration_id]=20', + 'not[iteration_id]=42', 'epic_id=12', 'not[epic_id]=34', 'weight=1', @@ -122,6 +130,7 @@ export const locationSearchWithSpecialValues = [ 'my_reaction_emoji=None', 'iteration_id=Current', 'label_name[]=None', + 'release_tag=None', 'milestone_title=Upcoming', 'epic_id=None', 'weight=None', @@ -134,12 +143,18 @@ export const filteredTokens = [ { type: 'assignee_username', value: { data: 'lisa', operator: OPERATOR_IS } }, { type: 'assignee_username', value: { data: 'patty', operator: OPERATOR_IS_NOT } }, { type: 'assignee_username', value: { data: 'selma', operator: OPERATOR_IS_NOT } }, + { type: 'milestone', value: { data: 'season 3', operator: OPERATOR_IS } }, { type: 'milestone', value: { data: 'season 4', operator: OPERATOR_IS } }, { type: 'milestone', value: { data: 'season 20', operator: OPERATOR_IS_NOT } }, + { type: 'milestone', value: { data: 'season 30', operator: OPERATOR_IS_NOT } }, { type: 'labels', value: { data: 'cartoon', operator: OPERATOR_IS } }, { type: 'labels', value: { data: 'tv', operator: OPERATOR_IS } }, { type: 'labels', value: { data: 'live action', operator: OPERATOR_IS_NOT } }, { type: 'labels', value: { data: 'drama', operator: OPERATOR_IS_NOT } }, + { type: 'release', value: { data: 'v3', operator: OPERATOR_IS } }, + { type: 'release', value: { data: 'v4', operator: OPERATOR_IS } }, + { type: 'release', value: { data: 'v20', operator: OPERATOR_IS_NOT } }, + { type: 'release', value: { data: 'v30', operator: OPERATOR_IS_NOT } }, { type: 'type', value: { data: 'issue', operator: OPERATOR_IS } }, { type: 'type', value: { data: 'feature', operator: OPERATOR_IS } }, { type: 'type', value: { data: 'bug', operator: OPERATOR_IS_NOT } }, @@ -148,7 +163,9 @@ export const filteredTokens = [ { type: 'my_reaction_emoji', value: { data: 'thumbsdown', operator: OPERATOR_IS_NOT } }, { type: 'confidential', value: { data: 'yes', operator: OPERATOR_IS } }, { type: 'iteration', value: { data: '4', operator: OPERATOR_IS } }, + { type: 'iteration', value: { data: '12', operator: OPERATOR_IS } }, { type: 'iteration', value: { data: '20', operator: OPERATOR_IS_NOT } }, + { type: 'iteration', value: { data: '42', operator: OPERATOR_IS_NOT } }, { type: 'epic_id', value: { data: '12', operator: OPERATOR_IS } }, { type: 'epic_id', value: { data: '34', operator: OPERATOR_IS_NOT } }, { type: 'weight', value: { data: '1', operator: OPERATOR_IS } }, @@ -163,6 +180,7 @@ export const filteredTokensWithSpecialValues = [ { type: 'my_reaction_emoji', value: { data: 'None', operator: OPERATOR_IS } }, { type: 'iteration', value: { data: 'Current', operator: OPERATOR_IS } }, { type: 'labels', value: { data: 'None', operator: OPERATOR_IS } }, + { type: 'release', value: { data: 'None', operator: OPERATOR_IS } }, { type: 'milestone', value: { data: 'Upcoming', operator: OPERATOR_IS } }, { type: 'epic_id', value: { data: 'None', operator: OPERATOR_IS } }, { type: 'weight', value: { data: 'None', operator: OPERATOR_IS } }, @@ -171,22 +189,24 @@ export const filteredTokensWithSpecialValues = [ export const apiParams = { authorUsername: 'homer', assigneeUsernames: ['bart', 'lisa'], - milestoneTitle: 'season 4', + milestoneTitle: ['season 3', 'season 4'], labelName: ['cartoon', 'tv'], + releaseTag: ['v3', 'v4'], types: ['ISSUE', 'FEATURE'], myReactionEmoji: 'thumbsup', confidential: true, - iterationId: '4', + iterationId: ['4', '12'], epicId: '12', weight: '1', not: { authorUsername: 'marge', assigneeUsernames: ['patty', 'selma'], - milestoneTitle: 'season 20', + milestoneTitle: ['season 20', 'season 30'], labelName: ['live action', 'drama'], + releaseTag: ['v20', 'v30'], types: ['BUG', 'INCIDENT'], myReactionEmoji: 'thumbsdown', - iterationId: '20', + iterationId: ['20', '42'], epicId: '34', weight: '3', }, @@ -197,6 +217,7 @@ export const apiParamsWithSpecialValues = { assigneeUsernames: 'bart', labelName: 'None', myReactionEmoji: 'None', + releaseTagWildcardId: 'NONE', iterationWildcardId: 'CURRENT', milestoneWildcardId: 'UPCOMING', epicId: 'None', @@ -208,17 +229,19 @@ export const urlParams = { 'not[author_username]': 'marge', 'assignee_username[]': ['bart', 'lisa'], 'not[assignee_username][]': ['patty', 'selma'], - milestone_title: 'season 4', - 'not[milestone_title]': 'season 20', + milestone_title: ['season 3', 'season 4'], + 'not[milestone_title]': ['season 20', 'season 30'], 'label_name[]': ['cartoon', 'tv'], 'not[label_name][]': ['live action', 'drama'], + release_tag: ['v3', 'v4'], + 'not[release_tag]': ['v20', 'v30'], 'type[]': ['issue', 'feature'], 'not[type][]': ['bug', 'incident'], my_reaction_emoji: 'thumbsup', 'not[my_reaction_emoji]': 'thumbsdown', confidential: 'yes', - iteration_id: '4', - 'not[iteration_id]': '20', + iteration_id: ['4', '12'], + 'not[iteration_id]': ['20', '42'], epic_id: '12', 'not[epic_id]': '34', weight: '1', @@ -229,6 +252,7 @@ export const urlParamsWithSpecialValues = { assignee_id: '123', 'assignee_username[]': 'bart', 'label_name[]': 'None', + release_tag: 'None', my_reaction_emoji: 'None', iteration_id: 'Current', milestone_title: 'Upcoming', diff --git a/spec/frontend/issues_list/utils_spec.js b/spec/frontend/issues_list/utils_spec.js index 458776d9ec5..8e1d70db92d 100644 --- a/spec/frontend/issues_list/utils_spec.js +++ b/spec/frontend/issues_list/utils_spec.js @@ -58,10 +58,10 @@ describe('getDueDateValue', () => { describe('getSortOptions', () => { describe.each` hasIssueWeightsFeature | hasBlockedIssuesFeature | length | containsWeight | containsBlocking - ${false} | ${false} | ${8} | ${false} | ${false} - ${true} | ${false} | ${9} | ${true} | ${false} - ${false} | ${true} | ${9} | ${false} | ${true} - ${true} | ${true} | ${10} | ${true} | ${true} + ${false} | ${false} | ${9} | ${false} | ${false} + ${true} | ${false} | ${10} | ${true} | ${false} + ${false} | ${true} | ${10} | ${false} | ${true} + ${true} | ${true} | ${11} | ${true} | ${true} `( 'when hasIssueWeightsFeature=$hasIssueWeightsFeature and hasBlockedIssuesFeature=$hasBlockedIssuesFeature', ({ diff --git a/spec/frontend/vue_mr_widget/mr_widget_options_spec.js b/spec/frontend/vue_mr_widget/mr_widget_options_spec.js index 19892539a8f..844e7330679 100644 --- a/spec/frontend/vue_mr_widget/mr_widget_options_spec.js +++ b/spec/frontend/vue_mr_widget/mr_widget_options_spec.js @@ -1,4 +1,4 @@ -import { GlBadge, GlLink, GlIcon, GlDropdown } from '@gitlab/ui'; +import { GlBadge, GlLink, GlIcon, GlButton, GlDropdown } from '@gitlab/ui'; import { mount } from '@vue/test-utils'; import MockAdapter from 'axios-mock-adapter'; import Vue, { nextTick } from 'vue'; @@ -947,6 +947,9 @@ describe('MrWidgetOptions', () => { // Renders a link in the row expect(collapsedSection.find(GlLink).exists()).toBe(true); expect(collapsedSection.find(GlLink).text()).toBe('GitLab.com'); + + expect(collapsedSection.find(GlButton).exists()).toBe(true); + expect(collapsedSection.find(GlButton).text()).toBe('Full report'); }); }); }); diff --git a/spec/frontend/vue_mr_widget/test_extension.js b/spec/frontend/vue_mr_widget/test_extension.js index 51bc44a7063..65c1bd8473b 100644 --- a/spec/frontend/vue_mr_widget/test_extension.js +++ b/spec/frontend/vue_mr_widget/test_extension.js @@ -31,6 +31,7 @@ export default { href: 'https://gitlab.com', text: 'GitLab.com', }, + actions: [{ text: 'Full report', href: 'https://gitlab.com', target: '_blank' }], }, ]); }, diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/mock_data.js b/spec/frontend/vue_shared/components/filtered_search_bar/mock_data.js index c2462d90a63..74cf6985b99 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/mock_data.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/mock_data.js @@ -9,6 +9,7 @@ import EpicToken from '~/vue_shared/components/filtered_search_bar/tokens/epic_t import IterationToken from '~/vue_shared/components/filtered_search_bar/tokens/iteration_token.vue'; import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue'; import MilestoneToken from '~/vue_shared/components/filtered_search_bar/tokens/milestone_token.vue'; +import ReleaseToken from '~/vue_shared/components/filtered_search_bar/tokens/release_token.vue'; import WeightToken from '~/vue_shared/components/filtered_search_bar/tokens/weight_token.vue'; export const mockAuthor1 = { @@ -132,6 +133,14 @@ export const mockMilestoneToken = { fetchMilestones: () => Promise.resolve({ data: mockMilestones }), }; +export const mockReleaseToken = { + type: 'release', + icon: 'rocket', + title: 'Release', + token: ReleaseToken, + fetchReleases: () => Promise.resolve(), +}; + export const mockEpicToken = { type: 'epic_iid', icon: 'clock', diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/release_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/release_token_spec.js new file mode 100644 index 00000000000..b804ff97b82 --- /dev/null +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/release_token_spec.js @@ -0,0 +1,78 @@ +import { GlFilteredSearchToken, GlFilteredSearchTokenSegment } from '@gitlab/ui'; +import { mount } from '@vue/test-utils'; +import waitForPromises from 'helpers/wait_for_promises'; +import createFlash from '~/flash'; +import ReleaseToken from '~/vue_shared/components/filtered_search_bar/tokens/release_token.vue'; +import { mockReleaseToken } from '../mock_data'; + +jest.mock('~/flash'); + +describe('ReleaseToken', () => { + const id = 123; + let wrapper; + + const createComponent = ({ config = mockReleaseToken, value = { data: '' } } = {}) => + mount(ReleaseToken, { + propsData: { + active: false, + config, + value, + }, + provide: { + portalName: 'fake target', + alignSuggestions: function fakeAlignSuggestions() {}, + suggestionsListClass: () => 'custom-class', + }, + }); + + afterEach(() => { + wrapper.destroy(); + }); + + it('renders release value', async () => { + wrapper = createComponent({ value: { data: id } }); + await wrapper.vm.$nextTick(); + + const tokenSegments = wrapper.findAllComponents(GlFilteredSearchTokenSegment); + + expect(tokenSegments).toHaveLength(3); // `Release` `=` `v1` + expect(tokenSegments.at(2).text()).toBe(id.toString()); + }); + + it('fetches initial values', () => { + const fetchReleasesSpy = jest.fn().mockResolvedValue(); + + wrapper = createComponent({ + config: { ...mockReleaseToken, fetchReleases: fetchReleasesSpy }, + value: { data: id }, + }); + + expect(fetchReleasesSpy).toHaveBeenCalledWith(id); + }); + + it('fetches releases on user input', () => { + const search = 'hello'; + const fetchReleasesSpy = jest.fn().mockResolvedValue(); + + wrapper = createComponent({ + config: { ...mockReleaseToken, fetchReleases: fetchReleasesSpy }, + }); + + wrapper.findComponent(GlFilteredSearchToken).vm.$emit('input', { data: search }); + + expect(fetchReleasesSpy).toHaveBeenCalledWith(search); + }); + + it('renders error message when request fails', async () => { + const fetchReleasesSpy = jest.fn().mockRejectedValue(); + + wrapper = createComponent({ + config: { ...mockReleaseToken, fetchReleases: fetchReleasesSpy }, + }); + await waitForPromises(); + + expect(createFlash).toHaveBeenCalledWith({ + message: 'There was a problem fetching releases.', + }); + }); +}); diff --git a/spec/helpers/issues_helper_spec.rb b/spec/helpers/issues_helper_spec.rb index 850051c7875..43b27dded3b 100644 --- a/spec/helpers/issues_helper_spec.rb +++ b/spec/helpers/issues_helper_spec.rb @@ -326,6 +326,7 @@ RSpec.describe IssuesHelper do new_issue_path: new_project_issue_path(project, issue: { milestone_id: finder.milestones.first.id }), project_import_jira_path: project_import_jira_path(project), quick_actions_help_path: help_page_path('user/project/quick_actions'), + releases_path: project_releases_path(project, format: :json), reset_path: new_issuable_address_project_path(project, issuable_type: 'issue'), rss_path: '#', show_new_issue_link: 'true', diff --git a/spec/lib/gitlab/metrics/samplers/action_cable_sampler_spec.rb b/spec/lib/gitlab/metrics/samplers/action_cable_sampler_spec.rb index f751416f4ec..d834b796179 100644 --- a/spec/lib/gitlab/metrics/samplers/action_cable_sampler_spec.rb +++ b/spec/lib/gitlab/metrics/samplers/action_cable_sampler_spec.rb @@ -23,64 +23,46 @@ RSpec.describe Gitlab::Metrics::Samplers::ActionCableSampler do allow(pool).to receive(:queue_length).and_return(6) end - shared_examples 'collects metrics' do |expected_labels| - it 'includes active connections' do - expect(subject.metrics[:active_connections]).to receive(:set).with(expected_labels, 0) + it 'includes active connections' do + expect(subject.metrics[:active_connections]).to receive(:set).with({}, 0) - subject.sample - end - - it 'includes minimum worker pool size' do - expect(subject.metrics[:pool_min_size]).to receive(:set).with(expected_labels, 1) - - subject.sample - end - - it 'includes maximum worker pool size' do - expect(subject.metrics[:pool_max_size]).to receive(:set).with(expected_labels, 2) - - subject.sample - end + subject.sample + end - it 'includes current worker pool size' do - expect(subject.metrics[:pool_current_size]).to receive(:set).with(expected_labels, 3) + it 'includes minimum worker pool size' do + expect(subject.metrics[:pool_min_size]).to receive(:set).with({}, 1) - subject.sample - end + subject.sample + end - it 'includes largest worker pool size' do - expect(subject.metrics[:pool_largest_size]).to receive(:set).with(expected_labels, 4) + it 'includes maximum worker pool size' do + expect(subject.metrics[:pool_max_size]).to receive(:set).with({}, 2) - subject.sample - end + subject.sample + end - it 'includes worker pool completed task count' do - expect(subject.metrics[:pool_completed_tasks]).to receive(:set).with(expected_labels, 5) + it 'includes current worker pool size' do + expect(subject.metrics[:pool_current_size]).to receive(:set).with({}, 3) - subject.sample - end + subject.sample + end - it 'includes worker pool pending task count' do - expect(subject.metrics[:pool_pending_tasks]).to receive(:set).with(expected_labels, 6) + it 'includes largest worker pool size' do + expect(subject.metrics[:pool_largest_size]).to receive(:set).with({}, 4) - subject.sample - end + subject.sample end - context 'for in-app mode' do - before do - expect(Gitlab::ActionCable::Config).to receive(:in_app?).and_return(true) - end + it 'includes worker pool completed task count' do + expect(subject.metrics[:pool_completed_tasks]).to receive(:set).with({}, 5) - it_behaves_like 'collects metrics', server_mode: 'in-app' + subject.sample end - context 'for standalone mode' do - before do - expect(Gitlab::ActionCable::Config).to receive(:in_app?).and_return(false) - end + it 'includes worker pool pending task count' do + expect(subject.metrics[:pool_pending_tasks]).to receive(:set).with({}, 6) - it_behaves_like 'collects metrics', server_mode: 'standalone' + subject.sample end end end diff --git a/spec/lib/gitlab/runtime_spec.rb b/spec/lib/gitlab/runtime_spec.rb index 96bc5448790..4627a8db82e 100644 --- a/spec/lib/gitlab/runtime_spec.rb +++ b/spec/lib/gitlab/runtime_spec.rb @@ -48,10 +48,9 @@ RSpec.describe Gitlab::Runtime do before do stub_const('::Puma', puma_type) - stub_env('ACTION_CABLE_IN_APP', 'false') end - it_behaves_like "valid runtime", :puma, 1 + it_behaves_like "valid runtime", :puma, 1 + Gitlab::ActionCable::Config.worker_pool_size end context "puma with cli_config" do @@ -61,27 +60,16 @@ RSpec.describe Gitlab::Runtime do before do stub_const('::Puma', puma_type) allow(puma_type).to receive_message_chain(:cli_config, :options).and_return(max_threads: 2, workers: max_workers) - stub_env('ACTION_CABLE_IN_APP', 'false') end - it_behaves_like "valid runtime", :puma, 3 + it_behaves_like "valid runtime", :puma, 3 + Gitlab::ActionCable::Config.worker_pool_size - context "when ActionCable in-app mode is enabled" do + context "when ActionCable worker pool size is configured" do before do - stub_env('ACTION_CABLE_IN_APP', 'true') - stub_env('ACTION_CABLE_WORKER_POOL_SIZE', '3') + stub_env('ACTION_CABLE_WORKER_POOL_SIZE', 10) end - it_behaves_like "valid runtime", :puma, 6 - end - - context "when ActionCable standalone is run" do - before do - stub_const('ACTION_CABLE_SERVER', true) - stub_env('ACTION_CABLE_WORKER_POOL_SIZE', '8') - end - - it_behaves_like "valid runtime", :puma, 11 + it_behaves_like "valid runtime", :puma, 13 end describe ".puma_in_clustered_mode?" do diff --git a/spec/serializers/service_field_entity_spec.rb b/spec/serializers/service_field_entity_spec.rb index d5a1c53d2f5..a06fdf95159 100644 --- a/spec/serializers/service_field_entity_spec.rb +++ b/spec/serializers/service_field_entity_spec.rb @@ -86,7 +86,7 @@ RSpec.describe ServiceFieldEntity do expected_hash = { type: 'select', name: 'branches_to_be_notified', - title: nil, + title: 'Branches for which notifications are to be sent', placeholder: nil, required: nil, choices: [['All branches', 'all'], ['Default branch', 'default'], ['Protected branches', 'protected'], ['Default branch and protected branches', 'default_and_protected']], diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb index 331cf291f21..44ffece7f3b 100644 --- a/spec/services/issues/update_service_spec.rb +++ b/spec/services/issues/update_service_spec.rb @@ -1248,28 +1248,38 @@ RSpec.describe Issues::UpdateService, :mailer do let(:closed_issuable) { create(:closed_issue, project: project) } end - context 'real-time updates' do - using RSpec::Parameterized::TableSyntax - + context 'broadcasting issue assignee updates' do let(:update_params) { { assignee_ids: [user2.id] } } - where(:action_cable_in_app_enabled, :feature_flag_enabled, :should_broadcast) do - true | true | true - true | false | true - false | true | true - false | false | false - end + context 'when feature flag is enabled' do + before do + stub_feature_flags(broadcast_issue_updates: true) + end + + it 'triggers the GraphQL subscription' do + expect(GraphqlTriggers).to receive(:issuable_assignees_updated).with(issue) + + update_issue(update_params) + end - with_them do - it 'broadcasts to the issues channel based on ActionCable and feature flag values' do - allow(Gitlab::ActionCable::Config).to receive(:in_app?).and_return(action_cable_in_app_enabled) - stub_feature_flags(broadcast_issue_updates: feature_flag_enabled) + context 'when assignee is not updated' do + let(:update_params) { { title: 'Some other title' } } - if should_broadcast - expect(GraphqlTriggers).to receive(:issuable_assignees_updated).with(issue) - else + it 'does not trigger the GraphQL subscription' do expect(GraphqlTriggers).not_to receive(:issuable_assignees_updated).with(issue) + + update_issue(update_params) end + end + end + + context 'when feature flag is disabled' do + before do + stub_feature_flags(broadcast_issue_updates: false) + end + + it 'does not trigger the GraphQL subscription' do + expect(GraphqlTriggers).not_to receive(:issuable_assignees_updated).with(issue) update_issue(update_params) end diff --git a/spec/tooling/danger/changelog_spec.rb b/spec/tooling/danger/changelog_spec.rb index 5777186cc28..377c3e881c9 100644 --- a/spec/tooling/danger/changelog_spec.rb +++ b/spec/tooling/danger/changelog_spec.rb @@ -228,7 +228,7 @@ RSpec.describe Tooling::Danger::Changelog do end context 'with changelog label' do - let(:mr_labels) { ['feature'] } + let(:mr_labels) { ['type::feature'] } it 'is truthy' do is_expected.to be_truthy @@ -236,7 +236,7 @@ RSpec.describe Tooling::Danger::Changelog do end context 'with no changelog label' do - let(:mr_labels) { ['tooling'] } + let(:mr_labels) { ['type::tooling'] } it 'is truthy' do is_expected.to be_falsey |