1# frozen_string_literal: true
2
3require 'spec_helper'
4
5RSpec.describe RemoteMirrorEntity do
6  let(:project) { create(:project, :repository, :remote_mirror, url: "https://test:password@gitlab.com") }
7  let(:remote_mirror) { project.remote_mirrors.first }
8  let(:entity) { described_class.new(remote_mirror) }
9
10  subject { entity.as_json }
11
12  it 'exposes remote-mirror-specific elements' do
13    is_expected.to include(
14      :id, :url, :enabled, :auth_method,
15      :ssh_known_hosts, :ssh_public_key, :ssh_known_hosts_fingerprints
16    )
17  end
18
19  it 'does not expose password information' do
20    expect(subject[:url]).not_to include('password')
21    expect(subject[:url]).to eq(remote_mirror.safe_url)
22  end
23end
24