Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-11-05 06:12:26 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-11-05 06:12:26 +0300
commit678db4e3943944ffd1c2b69af56cd5a61375972f (patch)
tree2dcc37074f276928e709f65f11a1f70ac83957d7 /spec/helpers
parentcdd01f01dcca9b2ec93f3e0538329c0b6cb222ae (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/notes_helper_spec.rb12
-rw-r--r--spec/helpers/one_trust_helper_spec.rb19
2 files changed, 12 insertions, 19 deletions
diff --git a/spec/helpers/notes_helper_spec.rb b/spec/helpers/notes_helper_spec.rb
index fc62bbf8bf8..913a38d353f 100644
--- a/spec/helpers/notes_helper_spec.rb
+++ b/spec/helpers/notes_helper_spec.rb
@@ -322,11 +322,21 @@ RSpec.describe NotesHelper do
describe '#notes_data' do
let(:issue) { create(:issue, project: project) }
- it 'sets last_fetched_at to 0 when start_at_zero is true' do
+ before do
@project = project
@noteable = issue
+ allow(helper).to receive(:current_user).and_return(guest)
+ end
+
+ it 'sets last_fetched_at to 0 when start_at_zero is true' do
expect(helper.notes_data(issue, true)[:lastFetchedAt]).to eq(0)
end
+
+ it 'includes the current notes filter for the user' do
+ guest.set_notes_filter(UserPreference::NOTES_FILTERS[:only_comments], issue)
+
+ expect(helper.notes_data(issue)[:notesFilter]).to eq(UserPreference::NOTES_FILTERS[:only_comments])
+ end
end
end
diff --git a/spec/helpers/one_trust_helper_spec.rb b/spec/helpers/one_trust_helper_spec.rb
index 85c38885304..20b731ac73d 100644
--- a/spec/helpers/one_trust_helper_spec.rb
+++ b/spec/helpers/one_trust_helper_spec.rb
@@ -4,11 +4,8 @@ require "spec_helper"
RSpec.describe OneTrustHelper do
describe '#one_trust_enabled?' do
- let(:user) { nil }
-
before do
stub_config(extra: { one_trust_id: SecureRandom.uuid })
- allow(helper).to receive(:current_user).and_return(user)
end
subject(:one_trust_enabled?) { helper.one_trust_enabled? }
@@ -18,20 +15,10 @@ RSpec.describe OneTrustHelper do
stub_feature_flags(ecomm_instrumentation: false)
end
- context 'when id is set and no user is set' do
- let(:user) { instance_double('User') }
-
- it { is_expected.to be_falsey }
- end
+ it { is_expected.to be_falsey }
end
context 'with ecomm_instrumentation feature flag enabled' do
- context 'when current user is set' do
- let(:user) { instance_double('User') }
-
- it { is_expected.to be_falsey }
- end
-
context 'when no id is set' do
before do
stub_config(extra: {})
@@ -39,10 +26,6 @@ RSpec.describe OneTrustHelper do
it { is_expected.to be_falsey }
end
-
- context 'when id is set and no user is set' do
- it { is_expected.to be_truthy }
- end
end
end
end