require 'serverspec'

# Required by serverspec
set :backend, :exec

describe package('redis-server'), :if => ['debian', 'ubuntu'].include?(os[:family]) do
  it { should be_installed }
end

describe package('redis'), :if => ['redhat', 'centos'].include?(os[:family]) do
  it { should be_installed }
end

require 'serverspec'

# Required by serverspec
set :backend, :exec

case os[:family]
when 'debian','ubuntu'
  package_name = 'redis-server'
  service_name = 'redis-server'
  config_file = '/etc/redis/redis.conf'
when 'redhat','centos'
  package_name = 'redis'
  service_name = 'redis'
  config_file = '/etc/redis.conf'
else
  package_name = 'redis'
  service_name = 'redis'
  config_file = '/etc/redis.conf'
end

describe package(package_name) do
  it { should be_installed }
end

describe service(service_name) do
  it { should be_running }
  it { should be_enabled }
end

describe file(config_file) do
  if { should exist }
end

Update serverspec tests read for testing
Update serverspec tests read for testing

Make them more dynamic, using variables instead of lots of duplicated tests with
os_family-based "if" statements.
