Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Bajao <ebajao@gitlab.com>2019-08-29 07:21:59 +0300
committerPatrick Bajao <ebajao@gitlab.com>2019-08-29 11:33:04 +0300
commitb047359de5b365022d63b8da10a3a87f3ad92397 (patch)
tree0428f8da4886618c94e25671299e7f7319b35738 /spec/lib/system_check
parent0e33f16b5f93382214f806737d3fcf5e065c5447 (diff)
Refactor specs to use one-liner expectation
Diffstat (limited to 'spec/lib/system_check')
-rw-r--r--spec/lib/system_check/app/authorized_keys_permission_check_spec.rb27
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