Replace deprecated stub from rspec-mocks

... according to the following warning.

Using `stub` from rspec-mocks' old `:should` syntax without explicitly
enabling the syntax is deprecated. Use the new `:expect` syntax or
explicitly enable `:should` instead.

Change-Id: I45564a4bc3346037265a3363b3bd635b4c9f53e1
This commit is contained in:
Takashi Kajinami 2023-12-04 23:32:37 +09:00
parent f0a77d2cc2
commit 55df880f95

View File

@ -9,29 +9,17 @@ provider_class = Puppet::Type.type(:service).provider(:swiftinit)
describe provider_class do describe provider_class do
before(:each) do before(:each) do
# Create a mock resource
@resource = stub 'resource'
@provider = provider_class.new @provider = provider_class.new
# A catch all; no parameters set allow(@provider.resource).to receive(:[]).with(:name).and_return('swift-object-server')
allow(@resource).to receive(:[]).and_return(nil) allow(@provider.resource).to receive(:[]).with(:ensure).and_return(:enable)
allow(@provider.resource).to receive(:[]).with(:pattern).and_return('swift-object')
# But set name, source and path allow(@provider.resource).to receive(:[]).with(:manifest).and_return('object-server')
allow(@resource).to receive(:[]).with(:name).and_return "swift-object-server" allow(@provider.resource).to receive(:ref).and_return('Service[myservice]')
allow(@resource).to receive(:[]).with(:ensure).and_return :enable
allow(@resource).to receive(:[]).with(:pattern).and_return "swift-object"
allow(@resource).to receive(:[]).with(:manifest).and_return "object-server"
allow(@resource).to receive(:ref).and_return "Service[myservice]"
@provider.resource = @resource
allow(@provider).to receive(:command).with(:systemctl_run).and_return "systemctl_run"
allow(@provider).to receive(:command).with(:systemctl_run).and_return('systemctl_run')
allow(@provider).to receive(:systemctl_run) allow(@provider).to receive(:systemctl_run)
end end
it "should have a status method" do it "should have a status method" do