Skip to content

Commit

Permalink
(maint) Rubocop Fixes
Browse files Browse the repository at this point in the history
- RSpec/ExampleWording
  • Loading branch information
david22swan committed Jan 9, 2024
1 parent c8ab325 commit d1219ef
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion spec/acceptance/composite_namevar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
expect(status.exitstatus).to eq 0
end

it 'will remove an existing resource' do
it 'removes an existing resource' do
stdout_str, status = Open3.capture2e("puppet resource #{common_args} composite_namevar php-gem ensure=absent")
expect(stdout_str.strip).to match(/^composite_namevar \{ 'php-gem'/)
expect(stdout_str.strip).to match(/package\s*=> 'php'/)
Expand Down
4 changes: 2 additions & 2 deletions spec/acceptance/namevar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@
expect(status).to eq 0
end

it 'will remove an existing resource' do
it 'removes an existing resource' do
stdout_str, status = Open3.capture2e("puppet resource #{common_args} multiple_namevar php manager=gem ensure=absent")
expect(stdout_str.strip).to match(/^multiple_namevar \{ 'php'/)
expect(stdout_str.strip).to match(/ensure\s*=> 'absent'/)
expect(status).to eq 0
end

it 'will ignore the title if namevars are provided' do
it 'ignores the title if namevars are provided' do
stdout_str, status = Open3.capture2e("puppet resource #{common_args} multiple_namevar whatever package=php manager=gem")
expect(stdout_str.strip).to match(/^multiple_namevar \{ 'whatever'/)
expect(stdout_str.strip).to match(/package\s*=> 'php'/)
Expand Down
8 changes: 4 additions & 4 deletions spec/puppet/resource_api/puppet_context_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@
ex
end

it 'will log message at error level and with trace' do
it 'logs message at error level and with trace' do
expect(Puppet::Util::Log).to receive(:create).with(level: :err, message: "some_resource: message: x\na\nb\nc")
context.log_exception(exception, message: 'message', trace: true)
end

it 'will log message at error level and without trace' do
it 'logs message at error level and without trace' do
expect(Puppet::Util::Log).to receive(:create).with(level: :err, message: 'some_resource: message: x')
context.log_exception(exception, message: 'message', trace: false)
end
Expand All @@ -75,7 +75,7 @@
allow(Puppet).to receive(:[]).with(:trace).and_return(true)
end

it 'will log message at error level and with trace,' do
it 'logs message at error level and with trace,' do
expect(Puppet::Util::Log).to receive(:create).with(level: :err, message: "some_resource: message: x\na\nb\nc")
context.log_exception(exception, message: 'message', trace: false)
end
Expand All @@ -87,7 +87,7 @@
allow(Puppet).to receive(:[]).with(:trace).and_return(false)
end

it 'will log message at error level and without trace,' do
it 'logs message at error level and without trace,' do
expect(Puppet::Util::Log).to receive(:create).with(level: :err, message: 'some_resource: message: x')
context.log_exception(exception, message: 'message', trace: false)
end
Expand Down
20 changes: 10 additions & 10 deletions spec/puppet/resource_api/transport/wrapper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class SomethingSomethingDarkside; end
context 'with a file:// prefix' do
let(:url) { 'file:///etc/credentials' }

it 'will not throw an error' do
it 'does not throw an error' do
allow(File).to receive(:exist?).and_return(true)
allow(Hocon).to receive(:load).and_call_original
expect(Puppet::ResourceApi::Transport).to receive(:connect)
Expand All @@ -38,7 +38,7 @@ class SomethingSomethingDarkside; end
context 'when called with a config hash' do
let(:config) { {} }

it 'will use the configuration directly' do
it 'uses the configuration directly' do
allow(Hocon).to receive(:load).and_call_original
expect(Hocon).not_to receive(:load).with('/etc/credentials', any_args)
expect(Puppet::ResourceApi::Transport).to receive(:connect)
Expand All @@ -50,7 +50,7 @@ class SomethingSomethingDarkside; end
let(:transport) { Puppet::Transport::SomethingSomethingDarkside.new }
let(:instance) { described_class.new('something_something_darkside', transport) }

it 'will set the @transport class variable' do
it 'sets the @transport class variable' do
expect(instance.instance_variable_get(:@transport)).to eq(transport)
end
end
Expand All @@ -63,7 +63,7 @@ class SomethingSomethingDarkside; end
let(:facts) { { 'foo' => 'bar' } }
let(:transport) { instance_double(Puppet::Transport::TestDevice, 'transport') }

it 'will return the facts provided by the transport' do
it 'returns the facts provided by the transport' do
allow(Puppet::ResourceApi::Transport).to receive(:connect).and_return(transport)
allow(Puppet::ResourceApi::Transport).to receive(:list).and_return(schema: :dummy)
allow(Puppet::ResourceApi::PuppetContext).to receive(:new).and_return(context)
Expand All @@ -80,7 +80,7 @@ class SomethingSomethingDarkside; end
let(:transport) { instance_double(Puppet::Transport::TestDevice, 'transport') }
let(:context) { instance_double(Puppet::ResourceApi::PuppetContext, 'context') }

it 'will return the facts provided by the transport' do
it 'returns the facts provided by the transport' do
allow(Puppet::ResourceApi::Transport).to receive(:connect).and_return(transport)
expect(transport).to receive(:close)

Expand All @@ -92,7 +92,7 @@ class SomethingSomethingDarkside; end
let(:instance) { described_class.new('wibble', {}) }
let(:transport) { instance_double(Puppet::Transport::TestDevice, 'transport') }

it 'will raise a NoMethodError' do
it 'raises a NoMethodError' do
allow(Puppet::ResourceApi::Transport).to receive(:connect).and_return(transport)
expect { instance.wibble }.to raise_error NoMethodError
end
Expand All @@ -109,13 +109,13 @@ class SomethingSomethingDarkside; end

context 'when the transport does not support the function' do
context 'when using respond_to?' do
it 'will return false' do
it 'returns false' do
expect(instance.respond_to?(:wibble)).to eq(false)
end
end

context 'when using method?' do
it 'will return false' do
it 'returns false' do
expect { instance.method :wibble }.to raise_error NameError, /undefined method `wibble'/
end
end
Expand All @@ -127,13 +127,13 @@ class SomethingSomethingDarkside; end
end

context 'when using respond_to?' do
it 'will return true' do
it 'returns true' do
expect(instance.respond_to?(:close)).to eq(true)
end
end

context 'when using method?' do
it 'will return the method' do
it 'returns the method' do
expect(instance.method(:close)).to be_a(Method)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/puppet/resource_api/transport_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class Wibble; end
end

context 'when the transport being validated has not be registered' do
it 'will throw an unregistered error message' do
it 'throws an unregistered error message' do
expect(described_class).to receive(:require).with('puppet/transport/schema/wibble')
expect { described_class.send(:validate, 'wibble', {}) }.to raise_error Puppet::DevError, %r{ not registered with }
end
Expand Down
18 changes: 9 additions & 9 deletions spec/puppet/resource_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def set(_context, _changes); end
context 'when strict is default (:warning)' do
let(:strict_level) { :warning }

it 'will log error at warning level' do
it 'logs error at warning level' do
expect(Puppet).to receive(:warning).with(message)
instance.retrieve
end
Expand All @@ -361,7 +361,7 @@ def set(_context, _changes); end
context 'when strict is :off' do
let(:strict_level) { :off }

it 'will log error at debug level' do
it 'logs error at debug level' do
instance.retrieve
expect(log_sink.map(&:message)).to include(message)
end
Expand Down Expand Up @@ -1569,7 +1569,7 @@ def set(_context, changes)

it { expect(instance.strict_check(nil)).to be_nil }

it 'will not log a warning message' do
it 'does not log a warning message' do
expect(Puppet).not_to receive(:warning)
instance.strict_check(nil)
end
Expand All @@ -1578,7 +1578,7 @@ def set(_context, changes)
context 'when Puppet strict setting is :error' do
let(:strict_level) { :error }

it 'will throw an exception' do
it 'throws an exception' do
expect do
instance.strict_check({})
end.to raise_error(Puppet::DevError, /has not provided canonicalized values/)
Expand All @@ -1590,7 +1590,7 @@ def set(_context, changes)

it { expect(instance.strict_check({})).to be_nil }

it 'will log warning message' do
it 'logs warning message' do
expect(Puppet).to receive(:warning).with(/has not provided canonicalized values/)
instance.strict_check({})
end
Expand All @@ -1603,7 +1603,7 @@ def set(_context, changes)

it { expect(instance.strict_check(test_string: 'canon')).to be_nil }

it 'will not log a warning message' do
it 'does not log a warning message' do
expect(Puppet).not_to receive(:warning)
instance.strict_check(test_string: 'canon')
end
Expand All @@ -1612,7 +1612,7 @@ def set(_context, changes)
context 'when Puppet strict setting is :error' do
let(:strict_level) { :error }

it 'will throw an exception' do
it 'throws an exception' do
expect { instance.strict_check(test_string: 'canon') }.not_to raise_error
end
end
Expand All @@ -1622,7 +1622,7 @@ def set(_context, changes)

it { expect(instance.strict_check(test_string: 'canon')).to be_nil }

it 'will not log a warning message' do
it 'does not log a warning message' do
expect(Puppet).not_to receive(:warning)
instance.strict_check(test_string: 'canon')
end
Expand Down Expand Up @@ -1917,7 +1917,7 @@ def set(_context, changes)
end

context 'when strict checking is on' do
it('will not throw') {
it('does not throw') {
Puppet.settings[:strict] = :error
expect { described_class.register_type(definition) }.not_to raise_error
}
Expand Down

0 comments on commit d1219ef

Please sign in to comment.