Skip to content

Commit d20d19d

Browse files
committed
rubocop: Fix RSpec/BeNil
1 parent 37ffb91 commit d20d19d

45 files changed

Lines changed: 122 additions & 122 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

spec/custom_facts/core/execution/posix_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424

2525
it 'returns nil if the binary is not executable' do
2626
allow(File).to receive(:executable?).with('/opt/foo').and_return(false)
27-
expect(posix_executor.which('/opt/foo')).to be nil
27+
expect(posix_executor.which('/opt/foo')).to be_nil
2828
end
2929

3030
it 'returns nil if the binary is not a file' do
3131
allow(File).to receive(:executable?).with('/opt/foo').and_return(true)
3232
allow(FileTest).to receive(:file?).with('/opt/foo').and_return false
33-
expect(posix_executor.which('/opt/foo')).to be nil
33+
expect(posix_executor.which('/opt/foo')).to be_nil
3434
end
3535
end
3636

@@ -46,7 +46,7 @@
4646
allow(File).to receive(:executable?).with('/bin/foo').and_return false
4747
allow(File).to receive(:executable?).with('/sbin/foo').and_return false
4848
allow(File).to receive(:executable?).with('/usr/sbin/foo').and_return false
49-
expect(posix_executor.which('foo')).to be nil
49+
expect(posix_executor.which('foo')).to be_nil
5050
end
5151
end
5252
end
@@ -88,7 +88,7 @@
8888

8989
it 'returns nil if not found' do
9090
allow(posix_executor).to receive(:which).with('foo').and_return nil
91-
expect(posix_executor.expand_command('foo -a | stuff >> /dev/null')).to be nil
91+
expect(posix_executor.expand_command('foo -a | stuff >> /dev/null')).to be_nil
9292
end
9393
end
9494

spec/custom_facts/core/execution/windows_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@
6464
it 'returns nil if the binary path is not executable' do
6565
allow(File).to receive(:executable?).with('C:\Tools\foo.exe').and_return false
6666

67-
expect(executor.which('C:\Tools\foo.exe')).to be nil
67+
expect(executor.which('C:\Tools\foo.exe')).to be_nil
6868
end
6969

7070
it 'returns nil if the binary is not executable' do
7171
allow(File).to receive(:executable?).with('\\\\remote\dir\foo.exe').and_return false
7272

73-
expect(executor.which('\\\\remote\dir\foo.exe')).to be nil
73+
expect(executor.which('\\\\remote\dir\foo.exe')).to be_nil
7474
end
7575
end
7676

@@ -108,7 +108,7 @@
108108
allow(File).to receive(:executable?).with('C:\Windows\foo.exe').and_return false
109109
allow(File).to receive(:executable?).with('C:\Windows\System32\Wbem\foo.exe').and_return false
110110

111-
expect(executor.which('foo.exe')).to be nil
111+
expect(executor.which('foo.exe')).to be_nil
112112
end
113113
end
114114
end
@@ -129,7 +129,7 @@
129129

130130
it 'does not expand single quoted binary' do
131131
allow(executor).to receive(:which).with('\'C:\My').and_return nil
132-
expect(executor.expand_command('\'C:\My Tools\foo.exe\' /a /b')).to be nil
132+
expect(executor.expand_command('\'C:\My Tools\foo.exe\' /a /b')).to be_nil
133133
end
134134

135135
it 'quotes expanded binary if found in path with spaces' do
@@ -146,7 +146,7 @@
146146

147147
it 'returns nil if command not found' do
148148
allow(executor).to receive(:which).with('foo').and_return nil
149-
expect(executor.expand_command('foo /a | stuff >> NUL')).to be nil
149+
expect(executor.expand_command('foo /a | stuff >> NUL')).to be_nil
150150
end
151151
end
152152

spec/custom_facts/util/collection_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def load(collection)
144144

145145
it 'returns nil if it cannot find or load the fact' do
146146
allow(collection.internal_loader).to receive(:load).with(:testing)
147-
expect(collection.fact('testing')).to be nil
147+
expect(collection.fact('testing')).to be_nil
148148
end
149149
end
150150

spec/custom_facts/util/fact_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129

130130
describe 'when returning a value' do
131131
it 'returns nil if there are no resolutions' do
132-
expect(Facter::Util::Fact.new('yay').value).to be nil
132+
expect(Facter::Util::Fact.new('yay').value).to be_nil
133133
end
134134

135135
it 'prefers the highest weight resolution' do

spec/custom_facts/util/parser_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def expects_script_to_return(path, content, result, err = nil)
147147
def expects_parser_to_return_nil_for_directory(path)
148148
allow(FileTest).to receive(:file?).with(path).and_return(false)
149149

150-
expect(LegacyFacter::Util::Parser.parser_for(path).results).to be nil
150+
expect(LegacyFacter::Util::Parser.parser_for(path).results).to be_nil
151151
end
152152

153153
it 'returns a hash of whatever is returned by the executable' do
@@ -310,7 +310,7 @@ def expects_to_parse_powershell(cmd, result)
310310

311311
describe 'nothing parser' do
312312
it 'uses the nothing parser when there is no other parser' do
313-
expect(LegacyFacter::Util::Parser.parser_for('this.is.not.valid').results).to be nil
313+
expect(LegacyFacter::Util::Parser.parser_for('this.is.not.valid').results).to be_nil
314314
end
315315
end
316316

spec/facter/facter_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def stub_no_fact
213213
it 'returns nil' do
214214
stub_no_fact
215215

216-
expect(Facter.value('os.name')).to be nil
216+
expect(Facter.value('os.name')).to be_nil
217217
end
218218

219219
context 'when fact value is false' do
@@ -314,7 +314,7 @@ def stub_no_fact
314314
it 'searches os core fact and returns nil' do
315315
allow(Facter::FactManager.instance).to receive(:resolve_core).with(['os.name']).and_return([])
316316

317-
expect(Facter.core_value('os.name')).to be nil
317+
expect(Facter.core_value('os.name')).to be_nil
318318
end
319319
end
320320

@@ -488,7 +488,7 @@ def stub_no_fact
488488
it 'logs a debug message' do
489489
allow(logger).to receive(:debug).with('test')
490490

491-
expect(Facter.debug(message)).to be(nil)
491+
expect(Facter.debug(message)).to be_nil
492492
end
493493
end
494494

spec/facter/resolvers/aio_agent_version_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
end
4646

4747
it 'resolves to nil' do
48-
expect(Facter::Resolvers::AioAgentVersion.resolve(:aio_agent_version)).to be(nil)
48+
expect(Facter::Resolvers::AioAgentVersion.resolve(:aio_agent_version)).to be_nil
4949
end
5050
end
5151
end

spec/facter/resolvers/aix/architecture_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
let(:result) { 'test = x86' }
3333

3434
it 'detects architecture as nil' do
35-
expect(Facter::Resolvers::Architecture.resolve(:architecture)).to be(nil)
35+
expect(Facter::Resolvers::Architecture.resolve(:architecture)).to be_nil
3636
end
3737
end
3838

3939
context 'when fails to retrieve fact' do
4040
let(:result) { nil }
4141

4242
it 'detects architecture as nil' do
43-
expect(Facter::Resolvers::Architecture.resolve(:architecture)).to be(nil)
43+
expect(Facter::Resolvers::Architecture.resolve(:architecture)).to be_nil
4444
end
4545
end
4646
end

spec/facter/resolvers/aix/filesystems_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
it 'returns nil' do
3232
result = Facter::Resolvers::Aix::Filesystems.resolve(:file_systems)
3333

34-
expect(result).to be(nil)
34+
expect(result).to be_nil
3535
end
3636
end
3737
end

spec/facter/resolvers/aix/hardware_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727
let(:result) { 'test = hardware' }
2828

2929
it 'detects hardware as nil' do
30-
expect(Facter::Resolvers::Hardware.resolve(:hardware)).to be(nil)
30+
expect(Facter::Resolvers::Hardware.resolve(:hardware)).to be_nil
3131
end
3232
end
3333

3434
context 'when fails to retrieve fact' do
3535
let(:result) { nil }
3636

3737
it 'detects hardware as nil' do
38-
expect(Facter::Resolvers::Hardware.resolve(:hardware)).to be(nil)
38+
expect(Facter::Resolvers::Hardware.resolve(:hardware)).to be_nil
3939
end
4040
end
4141
end

0 commit comments

Comments
 (0)