summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/project.rb2
-rw-r--r--changelogs/unreleased/jc-fix-set-project-writable.yml5
-rw-r--r--spec/models/project_spec.rb10
3 files changed, 16 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 58254eb1bc9..8b60e38fb57 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1838,7 +1838,7 @@ class Project < ActiveRecord::Base
# Set repository as writable again
def set_repository_writable!
with_lock do
- update_column(repository_read_only, false)
+ update_column(:repository_read_only, false)
end
end
diff --git a/changelogs/unreleased/jc-fix-set-project-writable.yml b/changelogs/unreleased/jc-fix-set-project-writable.yml
new file mode 100644
index 00000000000..0bfd90c3967
--- /dev/null
+++ b/changelogs/unreleased/jc-fix-set-project-writable.yml
@@ -0,0 +1,5 @@
+---
+title: Fix method to mark a project repository as writable
+merge_request: 25546
+author:
+type: fixed
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index bcbe687f4a2..65cf04de13c 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -2511,6 +2511,16 @@ describe Project do
end
end
+ describe '#set_repository_writable!' do
+ it 'sets repository_read_only to false' do
+ project = create(:project, :read_only)
+
+ expect { project.set_repository_writable! }
+ .to change(project, :repository_read_only)
+ .from(true).to(false)
+ end
+ end
+
describe '#pushes_since_gc' do
let(:project) { create(:project) }