Replace mocha by rspec-mocks
puppetlabs_spec_helper recommends rspec-mocks instead of mocha[1] and
it uses rspec-mocks by default instead of mocha since v 5.0.0[2]
This is the prep work to adapt to that migration.
[1] https://github.com/puppetlabs/puppetlabs_spec_helper/#mock_with
[2] 493f0cbc1c
Closes-Bug: #2004135
Change-Id: I843c72def83a79783d68c9bcf1036d9beddb0e5d
This commit is contained in:
parent
59f4da0c71
commit
200c8f10e7
@ -10,6 +10,8 @@ RSpec.configure do |c|
|
|||||||
|
|
||||||
c.module_path = File.join(fixture_path, 'modules')
|
c.module_path = File.join(fixture_path, 'modules')
|
||||||
c.manifest_dir = File.join(fixture_path, 'manifests')
|
c.manifest_dir = File.join(fixture_path, 'manifests')
|
||||||
|
|
||||||
|
c.mock_with :rspec
|
||||||
end
|
end
|
||||||
|
|
||||||
at_exit { RSpec::Puppet::Coverage.report! }
|
at_exit { RSpec::Puppet::Coverage.report! }
|
||||||
|
@ -11,10 +11,10 @@ describe Puppet::Type.type(:vs_config).provider(:ovs) do
|
|||||||
|
|
||||||
context "Testing string values" do
|
context "Testing string values" do
|
||||||
before :each do
|
before :each do
|
||||||
described_class.expects(:vsctl).with(
|
expect(described_class).to receive(:vsctl).with(
|
||||||
"list", "Open_vSwitch", ".").returns 'key1 : value1
|
"list", "Open_vSwitch", ".").and_return('key1 : value1
|
||||||
key2 : value2
|
key2 : value2
|
||||||
key3 : value3'
|
key3 : value3')
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should return three resources" do
|
it "should return three resources" do
|
||||||
@ -43,10 +43,10 @@ key3 : value3'
|
|||||||
|
|
||||||
context "Testing array values" do
|
context "Testing array values" do
|
||||||
before :each do
|
before :each do
|
||||||
described_class.expects(:vsctl).with(
|
expect(described_class).to receive(:vsctl).with(
|
||||||
"list", "Open_vSwitch", ".").returns 'key1 : [abc, def, ghi]
|
"list", "Open_vSwitch", ".").and_return('key1 : [abc, def, ghi]
|
||||||
key2 : [def, abc, ghi]
|
key2 : [def, abc, ghi]
|
||||||
key3 : [1001, 399, 240, 1200]'
|
key3 : [1001, 399, 240, 1200]')
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should return three resources" do
|
it "should return three resources" do
|
||||||
@ -70,10 +70,10 @@ key3 : [1001, 399, 240, 1200]'
|
|||||||
|
|
||||||
context "Testing hash values" do
|
context "Testing hash values" do
|
||||||
before :each do
|
before :each do
|
||||||
described_class.expects(:vsctl).with(
|
expect(described_class).to receive(:vsctl).with(
|
||||||
"list", "Open_vSwitch", ".").returns 'key1 : {}
|
"list", "Open_vSwitch", ".").and_return('key1 : {}
|
||||||
key2 : {"hash21"="value21"}
|
key2 : {"hash21"="value21"}
|
||||||
key3 : {"hash31"="value31", "hash32"="value32", "hash33"=33}'
|
key3 : {"hash31"="value31", "hash32"="value32", "hash33"=33}')
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should return three resources" do
|
it "should return three resources" do
|
||||||
|
@ -18,27 +18,27 @@ describe Puppet::Type.type(:vs_ssl).provider(:ovs) do
|
|||||||
|
|
||||||
context 'when changing cert_file' do
|
context 'when changing cert_file' do
|
||||||
it 'should recreate ssl config' do
|
it 'should recreate ssl config' do
|
||||||
File.stubs(:file?).returns(true)
|
allow(File).to receive(':file?').and_return(true)
|
||||||
provider.expects(:destroy)
|
expect(provider).to receive(:destroy)
|
||||||
provider.expects(:create)
|
expect(provider).to receive(:create)
|
||||||
provider.cert_file = '/tmp/blah.crt'
|
provider.cert_file = '/tmp/blah.crt'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when changing key_file' do
|
context 'when changing key_file' do
|
||||||
it 'should recreate ssl config' do
|
it 'should recreate ssl config' do
|
||||||
File.stubs(:file?).returns(true)
|
allow(File).to receive(':file?').and_return(true)
|
||||||
provider.expects(:destroy)
|
expect(provider).to receive(:destroy)
|
||||||
provider.expects(:create)
|
expect(provider).to receive(:create)
|
||||||
provider.key_file = '/tmp/blah.pem'
|
provider.key_file = '/tmp/blah.pem'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when changing ca_file' do
|
context 'when changing ca_file' do
|
||||||
it 'should recreate ssl config' do
|
it 'should recreate ssl config' do
|
||||||
File.stubs(:file?).returns(true)
|
allow(File).to receive(':file?').and_return(true)
|
||||||
provider.expects(:destroy)
|
expect(provider).to receive(:destroy)
|
||||||
provider.expects(:create)
|
expect(provider).to receive(:create)
|
||||||
provider.ca_file = '/tmp/blah.crt'
|
provider.ca_file = '/tmp/blah.crt'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user