Skip to content

Commit

Permalink
fix known rspec deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
pcai committed Jun 10, 2024
1 parent 630a859 commit 749c0e1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ end

RSpec::Core::RakeTask.new(:spec) do |task|
task.pattern = 'tests/spec/**/*_spec.rb'
task.rspec_opts = ['--color', '-f documentation', '-r ./tests/spec/spec_helper']
task.rspec_opts = ['--color', '-r ./tests/spec/spec_helper']
end

# Run the integration test suite
Expand Down
20 changes: 10 additions & 10 deletions tests/spec/configuration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
require 'winrm/connection_opts'

describe WinRM::ConnectionOpts do
shared_examples 'invalid options' do
shared_examples 'invalid options' do |error_type|
it 'throws a validation error' do
expect { WinRM::ConnectionOpts.create_with_defaults(overrides) }.to raise_error
expect { WinRM::ConnectionOpts.create_with_defaults(overrides) }.to raise_error error_type
end
end

context 'when there are no overrides' do
it_behaves_like 'invalid options'
it_behaves_like 'invalid options', NameError
end

context 'when there are only username and password' do
Expand All @@ -19,7 +19,7 @@
}
end

it_behaves_like 'invalid options'
it_behaves_like 'invalid options', RuntimeError
end

context 'when there are only username and endpoint' do
Expand All @@ -30,7 +30,7 @@
}
end

it_behaves_like 'invalid options'
it_behaves_like 'invalid options', RuntimeError
end

context 'when there are only password and endpoint' do
Expand All @@ -41,7 +41,7 @@
}
end

it_behaves_like 'invalid options'
it_behaves_like 'invalid options', RuntimeError
end

context 'when there are only certificate and key' do
Expand All @@ -52,7 +52,7 @@
}
end

it_behaves_like 'invalid options'
it_behaves_like 'invalid options', RuntimeError
end

context 'when there are only certificate and endpoint' do
Expand All @@ -63,7 +63,7 @@
}
end

it_behaves_like 'invalid options'
it_behaves_like 'invalid options', RuntimeError
end

context 'when there are only key and endpoint' do
Expand All @@ -74,7 +74,7 @@
}
end

it_behaves_like 'invalid options'
it_behaves_like 'invalid options', RuntimeError
end

context 'when username, password, and endpoint are given' do
Expand Down Expand Up @@ -176,7 +176,7 @@
end
describe '#create_with_defaults' do
it 'raises an error' do
expect { WinRM::ConnectionOpts.create_with_defaults(overrides) }.to raise_error
expect { WinRM::ConnectionOpts.create_with_defaults(overrides) }.to raise_error ArgumentError
end
end
end
Expand Down
1 change: 1 addition & 0 deletions tests/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ def to_byte_string

RSpec.configure do |config|
config.include(SpecUnitHelper)
config.raise_errors_for_deprecations!
end
4 changes: 2 additions & 2 deletions tests/spec/wsmv/receive_response_reader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
# OMI server messages do not appear to include stdout when CommandState/Done
it 'does not raise an ArgumentError: invalid byte sequence in UTF-8' do
begin
expect(
expect do
subject.read_output(output_message)
).not_to raise_error
end.not_to raise_error
rescue RSpec::Expectations::ExpectationNotMetError => e
expect(e.message).not_to include 'ArgumentError'
end
Expand Down

0 comments on commit 749c0e1

Please sign in to comment.