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-09-06 12:11:02 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-09-06 12:11:02 +0300
commitaea64c367b180ea549aa115d8312b7c1832bc0b3 (patch)
tree31380951356b27ac47cc401f3fef2d4e59782c16 /spec/models
parent578fc865330cb9ce65746ea5c03e993348e62c96 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/internal_id_spec.rb32
-rw-r--r--spec/models/user_spec.rb49
2 files changed, 51 insertions, 30 deletions
diff --git a/spec/models/internal_id_spec.rb b/spec/models/internal_id_spec.rb
index a8a5ac98a5a..6364520ebb6 100644
--- a/spec/models/internal_id_spec.rb
+++ b/spec/models/internal_id_spec.rb
@@ -243,21 +243,7 @@ RSpec.describe InternalId do
stub_feature_flags(generate_iids_without_explicit_locking: false)
end
- context 'when the insert all feature flag is enabled' do
- before do
- stub_feature_flags(use_insert_all_in_internal_id: true)
- end
-
- it_behaves_like 'a monotonically increasing id generator'
- end
-
- context 'when the insert all feature flag is disabled' do
- before do
- stub_feature_flags(use_insert_all_in_internal_id: false)
- end
-
- it_behaves_like 'a monotonically increasing id generator'
- end
+ it_behaves_like 'a monotonically increasing id generator'
end
context 'when the explicit locking feature flag is enabled' do
@@ -265,21 +251,7 @@ RSpec.describe InternalId do
stub_feature_flags(generate_iids_without_explicit_locking: true)
end
- context 'when the insert all feature flag is enabled' do
- before do
- stub_feature_flags(use_insert_all_in_internal_id: true)
- end
-
- it_behaves_like 'a monotonically increasing id generator'
- end
-
- context 'when the insert all feature flag is disabled' do
- before do
- stub_feature_flags(use_insert_all_in_internal_id: false)
- end
-
- it_behaves_like 'a monotonically increasing id generator'
- end
+ it_behaves_like 'a monotonically increasing id generator'
end
describe '#increment_and_save!' do
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 7be90fdedbd..b41f65d62bd 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -3635,6 +3635,11 @@ RSpec.describe User do
it 'loads all the runners in the tree of groups' do
expect(user.ci_owned_runners).to contain_exactly(runner, group_runner)
end
+
+ it 'returns true for owns_runner?' do
+ expect(user.owns_runner?(runner)).to eq(true)
+ expect(user.owns_runner?(group_runner)).to eq(true)
+ end
end
end
@@ -3647,6 +3652,10 @@ RSpec.describe User do
it 'loads the runners in the group' do
expect(user.ci_owned_runners).to contain_exactly(group_runner)
end
+
+ it 'returns true for owns_runner?' do
+ expect(user.owns_runner?(group_runner)).to eq(true)
+ end
end
end
@@ -3655,6 +3664,10 @@ RSpec.describe User do
it 'loads the runner belonging to the project' do
expect(user.ci_owned_runners).to contain_exactly(runner)
end
+
+ it 'returns true for owns_runner?' do
+ expect(user.owns_runner?(runner)).to eq(true)
+ end
end
end
@@ -3667,6 +3680,10 @@ RSpec.describe User do
it 'loads the runners of the project' do
expect(user.ci_owned_runners).to contain_exactly(project_runner)
end
+
+ it 'returns true for owns_runner?' do
+ expect(user.owns_runner?(project_runner)).to eq(true)
+ end
end
context 'when the user is a developer' do
@@ -3677,6 +3694,10 @@ RSpec.describe User do
it 'does not load any runner' do
expect(user.ci_owned_runners).to be_empty
end
+
+ it 'returns false for owns_runner?' do
+ expect(user.owns_runner?(project_runner)).to eq(false)
+ end
end
context 'when the user is a reporter' do
@@ -3687,6 +3708,10 @@ RSpec.describe User do
it 'does not load any runner' do
expect(user.ci_owned_runners).to be_empty
end
+
+ it 'returns false for owns_runner?' do
+ expect(user.owns_runner?(project_runner)).to eq(false)
+ end
end
context 'when the user is a guest' do
@@ -3697,6 +3722,10 @@ RSpec.describe User do
it 'does not load any runner' do
expect(user.ci_owned_runners).to be_empty
end
+
+ it 'returns false for owns_runner?' do
+ expect(user.owns_runner?(project_runner)).to eq(false)
+ end
end
end
@@ -3709,6 +3738,10 @@ RSpec.describe User do
it 'does not load the runners of the group' do
expect(user.ci_owned_runners).to be_empty
end
+
+ it 'returns false for owns_runner?' do
+ expect(user.owns_runner?(runner)).to eq(false)
+ end
end
context 'when the user is a developer' do
@@ -3719,6 +3752,10 @@ RSpec.describe User do
it 'does not load any runner' do
expect(user.ci_owned_runners).to be_empty
end
+
+ it 'returns false for owns_runner?' do
+ expect(user.owns_runner?(runner)).to eq(false)
+ end
end
context 'when the user is a reporter' do
@@ -3729,6 +3766,10 @@ RSpec.describe User do
it 'does not load any runner' do
expect(user.ci_owned_runners).to be_empty
end
+
+ it 'returns false for owns_runner?' do
+ expect(user.owns_runner?(runner)).to eq(false)
+ end
end
context 'when the user is a guest' do
@@ -3739,6 +3780,10 @@ RSpec.describe User do
it 'does not load any runner' do
expect(user.ci_owned_runners).to be_empty
end
+
+ it 'returns false for owns_runner?' do
+ expect(user.owns_runner?(runner)).to eq(false)
+ end
end
end
@@ -3746,6 +3791,10 @@ RSpec.describe User do
it 'does not load any runner' do
expect(user.ci_owned_runners).to be_empty
end
+
+ it 'returns false for owns_runner?' do
+ expect(user.owns_runner?(create(:ci_runner))).to eq(false)
+ end
end
context 'with runner in a personal project' do