diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-15 18:09:53 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-15 18:09:53 +0300 |
commit | 51d5328e82229d69456d3a43dd2cf10518bf64c7 (patch) | |
tree | cca8c7aaea10c92398e03ae182b76c5cc514185c /spec/helpers | |
parent | 14771dc276c9cfdeed1a3915ee29301cd848b475 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/issuables_helper_spec.rb | 46 | ||||
-rw-r--r-- | spec/helpers/nav/top_nav_helper_spec.rb | 12 |
2 files changed, 45 insertions, 13 deletions
diff --git a/spec/helpers/issuables_helper_spec.rb b/spec/helpers/issuables_helper_spec.rb index bb2f9d03b87..069465c2fec 100644 --- a/spec/helpers/issuables_helper_spec.rb +++ b/spec/helpers/issuables_helper_spec.rb @@ -98,11 +98,55 @@ RSpec.describe IssuablesHelper do end end - describe '#issuable_meta' do + describe '#issuable_meta', time_travel_to: '2022-08-05 00:00:00 +0000' do let(:user) { create(:user) } let_it_be(:project) { create(:project) } + describe 'Issuable created status text' do + subject { helper.issuable_meta(issuable, project) } + + context 'when issuable is a work item and flag is off' do + using RSpec::Parameterized::TableSyntax + + before do + stub_feature_flags(work_items: false) + end + + where(:issuable_type, :text) do + :issue | 'Issue created Aug 05, 2022 by' + :incident | 'Incident created Aug 05, 2022 by' + end + + let(:issuable) { build_stubbed(:work_item, issuable_type, created_at: Date.current) } + + with_them do + it { is_expected.to have_content(text) } + end + end + + context 'when issuable is a work item and flag is on' do + using RSpec::Parameterized::TableSyntax + + where(:issuable_type, :text) do + :issue | 'Issue created Aug 05, 2022 by' + :incident | 'Incident created Aug 05, 2022 by' + end + + let(:issuable) { build_stubbed(:work_item, issuable_type, created_at: Date.current) } + + with_them do + it { is_expected.to have_content(text) } + end + end + + context 'when issuable is not a work item' do + let(:issuable) { build_stubbed(:merge_request, created_at: Date.current) } + + it { is_expected.to have_content('Created Aug 05, 2022') } + end + end + describe 'author status' do let(:issuable) { build(:merge_request, source_project: project, author: user, created_at: '2020-01-30') } diff --git a/spec/helpers/nav/top_nav_helper_spec.rb b/spec/helpers/nav/top_nav_helper_spec.rb index 9d43e057521..e4fa503b5ee 100644 --- a/spec/helpers/nav/top_nav_helper_spec.rb +++ b/spec/helpers/nav/top_nav_helper_spec.rb @@ -88,18 +88,6 @@ RSpec.describe Nav::TopNavHelper do expect(subject[:shortcuts]).to eq(expected_shortcuts) end - it 'has expected :secondary' do - expected_secondary = [ - ::Gitlab::Nav::TopNavMenuItem.build( - href: '/help', - id: 'help', - title: 'Help', - icon: 'question-o' - ) - ] - expect(subject[:secondary]).to eq(expected_secondary) - end - context 'with current nav as project' do before do helper.nav('project') |