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:
Diffstat (limited to 'spec/models/protected_branch_spec.rb')
-rw-r--r--spec/models/protected_branch_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/models/protected_branch_spec.rb b/spec/models/protected_branch_spec.rb
index a89f8778780..a173ab48f17 100644
--- a/spec/models/protected_branch_spec.rb
+++ b/spec/models/protected_branch_spec.rb
@@ -207,6 +207,28 @@ RSpec.describe ProtectedBranch do
end
end
+ describe "#allow_force_push?" do
+ context "when the attr allow_force_push is true" do
+ let(:subject_branch) { create(:protected_branch, allow_force_push: true, name: "foo") }
+
+ it "returns true" do
+ project = subject_branch.project
+
+ expect(described_class.allow_force_push?(project, "foo")).to eq(true)
+ end
+ end
+
+ context "when the attr allow_force_push is false" do
+ let(:subject_branch) { create(:protected_branch, allow_force_push: false, name: "foo") }
+
+ it "returns false" do
+ project = subject_branch.project
+
+ expect(described_class.allow_force_push?(project, "foo")).to eq(false)
+ end
+ end
+ end
+
describe '#any_protected?' do
context 'existing project' do
let(:project) { create(:project, :repository) }