X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Frabbitmq%2Fspec%2Facceptance%2Fuser_spec.rb;fp=3rdparty%2Fmodules%2Frabbitmq%2Fspec%2Facceptance%2Fuser_spec.rb;h=beff492e0d1f622aa82e29b6204b8e4ed5af9520;hb=94a8783f522bbf2996cb8a59b977dea583e8b0c7;hp=6aab665a4af9cac08c12c008ca219a178da76b72;hpb=e107504bce7d9b21cc301124fc7c39fdb0762374;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/user_spec.rb b/3rdparty/modules/rabbitmq/spec/acceptance/user_spec.rb index 6aab665a4..beff492e0 100644 --- a/3rdparty/modules/rabbitmq/spec/acceptance/user_spec.rb +++ b/3rdparty/modules/rabbitmq/spec/acceptance/user_spec.rb @@ -1,18 +1,16 @@ require 'spec_helper_acceptance' describe 'rabbitmq user:' do - - - context "create user resource" do - it 'should run successfully' do + context 'create user resource' do + it 'runs successfully' do pp = <<-EOS - if $::osfamily == 'RedHat' { + if $facts['os']['family'] == 'RedHat' { class { 'erlang': epel_enable => true } - Class['erlang'] -> Class['::rabbitmq'] + Class['erlang'] -> Class['rabbitmq'] } - class { '::rabbitmq': + class { 'rabbitmq': service_manage => true, - port => '5672', + port => 5672, delete_guest_user => true, admin_enable => true, } -> @@ -23,16 +21,36 @@ describe 'rabbitmq user:' do } EOS - apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) end - it 'should have the user' do - shell('rabbitmqctl list_users') do |r| - expect(r.stdout).to match(/dan.*administrator/) + # rubocop:disable RSpec/MultipleExpectations + it 'has the user' do + shell('rabbitmqctl list_users -q') do |r| + expect(r.stdout).to match(%r{dan.*administrator}) expect(r.exit_code).to be_zero end end + # rubocop:enable RSpec/MultipleExpectations + end + + context 'destroy user resource' do + it 'runs successfully' do + pp = <<-EOS + rabbitmq_user { 'dan': + ensure => absent, + } + EOS + + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end + it 'does not have the user' do + shell('rabbitmqctl list_users -q') do |r| + expect(r.stdout).not_to match(%r{dan\s+}) + end + end end end