You can square the checks for RedHat, Suse, and Debian by using a for loop. Try this.

<pre>
describe 'with default options' do
  ['RedHat','Suse','Debian'].each do |platform|
    context "on osfamily #{platform}" do
      let(:facts) { { :osfamily => platform } }

      it {
        should contain_file('nsswitch_config_file').with_content(/^printers:   user files$/)
        should contain_file('nsswitch_config_file').with_content(/^ipnodes:    files dns$/)
        should contain_file('nsswitch_config_file').with_content(/^auth_attr:  files$/)
        should contain_file('nsswitch_config_file').with_content(/^prof_attr:  files$/)
        should contain_file('nsswitch_config_file').with_content(/^project:    files$/)
      }
    end
  end
end
</pre>