From 021f5a31e273372e55701e784e0359f21bb0d28a Mon Sep 17 00:00:00 2001 From: Simon Hoenscheid Date: Tue, 29 Aug 2023 00:53:33 +0200 Subject: [PATCH] add missing tests for postgresql_conf provider --- .../provider/postgresql_conf/ruby_spec.rb | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/spec/unit/provider/postgresql_conf/ruby_spec.rb b/spec/unit/provider/postgresql_conf/ruby_spec.rb index b166a82f95..5338a6c23d 100644 --- a/spec/unit/provider/postgresql_conf/ruby_spec.rb +++ b/spec/unit/provider/postgresql_conf/ruby_spec.rb @@ -7,6 +7,54 @@ let(:resource) { Puppet::Type.type(:postgresql_conf).new(name: 'foo', value: 'bar') } let(:provider) { resource.provider } + # rubocop:disable RSpec/ReceiveMessages + before(:each) do + allow(provider).to receive(:file_path).and_return('/tmp/foo') + allow(provider).to receive(:read_file).and_return('foo = bar') + allow(provider).to receive(:write_file).and_return(true) + end + # rubocop:enable RSpec/ReceiveMessages + + it 'has a method parse_config' do + expect(provider).to respond_to(:parse_config) + end + + it 'has a method delete_header' do + expect(provider).to respond_to(:delete_header) + end + + it 'has a method add_header' do + expect(provider).to respond_to(:add_header) + end + + it 'has a method exists?' do + expect(provider).to respond_to(:exists?) + end + + it 'has a method create' do + expect(provider).to respond_to(:create) + end + + it 'has a method destroy' do + expect(provider).to respond_to(:destroy) + end + + it 'has a method value' do + expect(provider).to respond_to(:value) + end + + it 'has a method value=' do + expect(provider).to respond_to(:value=) + end + + it 'has a method comment' do + expect(provider).to respond_to(:comment) + end + + it 'has a method comment=' do + expect(provider).to respond_to(:comment=) + end + it 'is an instance of the Provider Ruby' do expect(provider).to be_an_instance_of Puppet::Type::Postgresql_conf::ProviderRuby end