Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(MAINT) - Fixing rubocop failures #355

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ RSpec/ContextWording:
- 'spec/unit/provider/reboot/linux_spec.rb'
- 'spec/unit/provider/reboot/posix_spec.rb'
- 'spec/unit/provider/reboot/windows_spec.rb'
- 'spec/unit/task/init_spec.rb'
- 'spec/unit/task/reboot_spec.rb'
- 'spec/unit/type/reboot_spec.rb'

# Offense count: 13
Expand All @@ -65,7 +65,7 @@ RSpec/DescribeClass:
- '**/spec/views/**/*'
- 'spec/acceptance/reboot_finished_spec.rb'
- 'spec/acceptance/reboot_immediate_spec.rb'
- 'spec/acceptance/reboot_message.spec.rb'
- 'spec/acceptance/reboot_with_custom_message_spec.rb'
- 'spec/acceptance/reboot_no_refresh_spec.rb'
- 'spec/acceptance/reboot_pending_spec.rb'
- 'spec/acceptance/reboot_resume_spec.rb'
Expand All @@ -91,14 +91,14 @@ RSpec/ExpectInHook:
# Offense count: 1
RSpec/SpecFilePathFormat:
Exclude:
- 'spec/unit/task/init_spec.rb'
- 'spec/unit/task/reboot_spec.rb'

# Offense count: 1
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
# Include: **/*_spec*rb*, **/spec/**/*
RSpec/SpecFilePathSuffix:
Exclude:
- 'spec/acceptance/reboot_message.spec.rb'
- 'spec/acceptance/reboot_with_custom_message_spec.rb'

# Offense count: 17
# Configuration parameters: AllowSubject.
Expand All @@ -123,5 +123,5 @@ RSpec/NoExpectationExample:
# Offense count: 21
RSpec/StubbedMock:
Exclude:
- 'spec/unit/task/init_spec.rb'
- 'spec/unit/task/reboot_spec.rb'
- 'spec/unit/type/reboot_spec.rb'
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'spec_helper_acceptance'

describe 'Custom Message' do
describe 'puppetlabs-reboot' do
let(:reboot_manifest) do
<<-MANIFEST
notify { 'step_1':
Expand All @@ -17,8 +17,7 @@

it 'Reboot Immediately with a Custom Message' do
result = apply_manifest(reboot_manifest, catch_failures: true, debug: true)
expect(result.stdout).to match(%r{shutdown -r \+1 "A different message"})
expect(result.stdout).to match(%r{shutdown -r \+1 "A different message"|shutdown.exe /r /t 60 /d p:4:1 /c "A different message"})
expect(result.stdout).to match(%r{Scheduling system reboot with message: "A different message"})
expect(reboot_issued_or_cancelled(['-r', '+1', 'A different message'])).to be(true)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# require_relative '../../../tasks/init'
require "#{File.dirname(__FILE__)}/../../../tasks/init.rb"

describe Reboot::Task do
describe Task::Reboot do
context 'on Windows' do
before(:each) do
allow(Facter).to receive(:value).with(:kernel).and_return('windows')
Expand Down
6 changes: 3 additions & 3 deletions tasks/init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
require 'facter'
require 'json'

class Reboot # rubocop:disable Style/ClassAndModuleChildren
module Task # rubocop:disable Style/ClassAndModuleChildren
# Class for rebooting the system. This doesn't need to be a class but it allows for automated testing
class Task
class Reboot
attr_accessor :timeout

def initialize(opts = {})
Expand Down Expand Up @@ -97,7 +97,7 @@ def unix_shutdown_command(params)
# Actually run the reboot if we got piped input
unless $stdin.tty?
begin
reboot = Reboot::Task.new(JSON.parse($stdin.read))
reboot = Task::Reboot.new(JSON.parse($stdin.read))
reboot.execute!

result = {
Expand Down
Loading