summaryrefslogtreecommitdiff
path: root/spec/models/remote_mirror_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-09-19 01:45:44 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-09-19 01:45:44 +0000
commit85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch)
tree9160f299afd8c80c038f08e1545be119f5e3f1e1 /spec/models/remote_mirror_spec.rb
parent15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff)
downloadgitlab-ce-85dc423f7090da0a52c73eb66faf22ddb20efff9.tar.gz
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'spec/models/remote_mirror_spec.rb')
-rw-r--r--spec/models/remote_mirror_spec.rb24
1 files changed, 20 insertions, 4 deletions
diff --git a/spec/models/remote_mirror_spec.rb b/spec/models/remote_mirror_spec.rb
index ebc9760ab14..4c3151f431c 100644
--- a/spec/models/remote_mirror_spec.rb
+++ b/spec/models/remote_mirror_spec.rb
@@ -142,6 +142,20 @@ RSpec.describe RemoteMirror, :mailer do
end
end
+ describe '#bare_url' do
+ it 'returns the URL without any credentials' do
+ remote_mirror = build(:remote_mirror, url: 'http://user:pass@example.com/foo')
+
+ expect(remote_mirror.bare_url).to eq('http://example.com/foo')
+ end
+
+ it 'returns an empty string when the URL is nil' do
+ remote_mirror = build(:remote_mirror, url: nil)
+
+ expect(remote_mirror.bare_url).to eq('')
+ end
+ end
+
describe '#update_repository' do
it 'performs update including options' do
git_remote_mirror = stub_const('Gitlab::Git::RemoteMirror', spy)
@@ -283,7 +297,7 @@ RSpec.describe RemoteMirror, :mailer do
let(:remote_mirror) { create(:project, :repository, :remote_mirror).remote_mirrors.first }
around do |example|
- Timecop.freeze { example.run }
+ freeze_time { example.run }
end
context 'with remote mirroring disabled' do
@@ -397,7 +411,7 @@ RSpec.describe RemoteMirror, :mailer do
let(:timestamp) { Time.current - 5.minutes }
around do |example|
- Timecop.freeze { example.run }
+ freeze_time { example.run }
end
before do
@@ -442,16 +456,18 @@ RSpec.describe RemoteMirror, :mailer do
end
describe '#disabled?' do
+ let_it_be(:project) { create(:project, :repository) }
+
subject { remote_mirror.disabled? }
context 'when disabled' do
- let(:remote_mirror) { build(:remote_mirror, enabled: false) }
+ let(:remote_mirror) { build(:remote_mirror, project: project, enabled: false) }
it { is_expected.to be_truthy }
end
context 'when enabled' do
- let(:remote_mirror) { build(:remote_mirror, enabled: true) }
+ let(:remote_mirror) { build(:remote_mirror, project: project, enabled: true) }
it { is_expected.to be_falsy }
end