Make RemoteMirror's only_protected_branches default value consistent
From https://gitlab.com/gitlab-org/gitlab-ce/issues/53515, we see the backend appears to have inconsistent default values for this column: * DB schema: false by default * UI checkbox: false by default * `RemoteMirror` model: true by default This leads to unintended behavior where the boolean is activated if the UI doesn't pass in a value for the checkbox.
This commit is contained in:
parent
75eb04161f
commit
207f0a1b16
2 changed files with 8 additions and 2 deletions
|
@ -15,8 +15,6 @@ class RemoteMirror < ActiveRecord::Base
|
|||
insecure_mode: true,
|
||||
algorithm: 'aes-256-cbc'
|
||||
|
||||
default_value_for :only_protected_branches, true
|
||||
|
||||
belongs_to :project, inverse_of: :remote_mirrors
|
||||
|
||||
validates :url, presence: true, url: { protocols: %w(ssh git http https), allow_blank: true, enforce_user: true }
|
||||
|
|
|
@ -174,7 +174,15 @@ describe RemoteMirror do
|
|||
end
|
||||
|
||||
context 'with remote mirroring enabled' do
|
||||
it 'defaults to disabling only protected branches' do
|
||||
expect(remote_mirror.only_protected_branches?).to be_falsey
|
||||
end
|
||||
|
||||
context 'with only protected branches enabled' do
|
||||
before do
|
||||
remote_mirror.only_protected_branches = true
|
||||
end
|
||||
|
||||
context 'when it did not update in the last minute' do
|
||||
it 'schedules a RepositoryUpdateRemoteMirrorWorker to run now' do
|
||||
expect(RepositoryUpdateRemoteMirrorWorker).to receive(:perform_async).with(remote_mirror.id, Time.now)
|
||||
|
|
Loading…
Reference in a new issue