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>2020-12-09 15:09:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-12-09 15:09:42 +0300
commit1361891b0a87187364d1586395df176a8984e914 (patch)
tree4f47ddf2cd0d06cd0eb98a7bf1b7001504e6416b /spec/helpers
parent109562e64e1e1c51fe32a7443df86ee63b856115 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/tree_helper_spec.rb18
-rw-r--r--spec/helpers/users_helper_spec.rb17
2 files changed, 35 insertions, 0 deletions
diff --git a/spec/helpers/tree_helper_spec.rb b/spec/helpers/tree_helper_spec.rb
index 620bf248d7b..136ec07e73d 100644
--- a/spec/helpers/tree_helper_spec.rb
+++ b/spec/helpers/tree_helper_spec.rb
@@ -216,6 +216,24 @@ RSpec.describe TreeHelper do
web_ide_url: "/-/ide/project/#{project.full_path}/edit/#{sha}/-/#{@path}"
)
end
+
+ it 'does not load blob from repository again' do
+ blob
+
+ expect(repository).not_to receive(:blob_at)
+
+ subject
+ end
+ end
+
+ context 'nil blob is passed' do
+ let(:blob) { nil }
+
+ it 'does not load blob from repository' do
+ expect(repository).not_to receive(:blob_at)
+
+ subject
+ end
end
context 'user does not have write access but a personal fork exists' do
diff --git a/spec/helpers/users_helper_spec.rb b/spec/helpers/users_helper_spec.rb
index 5b559e40a80..c92c6e6e78e 100644
--- a/spec/helpers/users_helper_spec.rb
+++ b/spec/helpers/users_helper_spec.rb
@@ -333,4 +333,21 @@ RSpec.describe UsersHelper do
allow(helper).to receive(:can?).with(current_user, :read_user_profile, user).and_return(allowed)
end
end
+
+ describe '#admin_users_data_attributes' do
+ subject(:data) { helper.admin_users_data_attributes([user]) }
+
+ it 'users matches the serialized json' do
+ entity = double
+ expect_next_instance_of(Admin::UserSerializer) do |instance|
+ expect(instance).to receive(:represent).with([user]).and_return(entity)
+ end
+ expect(entity).to receive(:to_json).and_return("{\"username\":\"admin\"}")
+ expect(data[:users]).to eq "{\"username\":\"admin\"}"
+ end
+
+ it 'paths matches the schema' do
+ expect(data[:paths]).to match_schema('entities/admin_users_data_attributes_paths')
+ end
+ end
end