diff options
Diffstat (limited to 'spec/lib/system_check/app/authorized_keys_permission_check_spec.rb')
-rw-r--r-- | spec/lib/system_check/app/authorized_keys_permission_check_spec.rb | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/spec/lib/system_check/app/authorized_keys_permission_check_spec.rb b/spec/lib/system_check/app/authorized_keys_permission_check_spec.rb index 0aa3539e2bd..ac216c1860c 100644 --- a/spec/lib/system_check/app/authorized_keys_permission_check_spec.rb +++ b/spec/lib/system_check/app/authorized_keys_permission_check_spec.rb @@ -3,13 +3,13 @@ require 'spec_helper' describe SystemCheck::App::AuthorizedKeysPermissionCheck do - subject { described_class.new } + subject(:system_check) { described_class.new } describe '#skip?' do + subject { system_check.skip? } + context 'authorized keys enabled' do - it 'returns false' do - expect(subject.skip?).to eq(false) - end + it { is_expected.to eq(false) } end context 'authorized keys not enabled' do @@ -17,34 +17,29 @@ describe SystemCheck::App::AuthorizedKeysPermissionCheck do stub_application_setting(authorized_keys_enabled: false) end - it 'returns true' do - expect(subject.skip?).to eq(true) - end + it { is_expected.to eq(true) } end end describe '#check?' do - let(:authorized_keys) { double } + subject { system_check.check? } before do - allow(Gitlab::AuthorizedKeys).to receive(:new).and_return(authorized_keys) - allow(authorized_keys).to receive(:accessible?).and_return(accessible?) + expect_next_instance_of(Gitlab::AuthorizedKeys) do |instance| + allow(instance).to receive(:accessible?) { accessible? } + end end context 'authorized keys is accessible' do let(:accessible?) { true } - it 'returns true' do - expect(subject.check?).to eq(true) - end + it { is_expected.to eq(true) } end context 'authorized keys is not accessible' do let(:accessible?) { false } - it 'returns false' do - expect(subject.check?).to eq(false) - end + it { is_expected.to eq(false) } end end end |