require 'spec_helper'

describe "memcached is not installed" do
  describe package('memcached') do
    it { should_not be_installed }
  end
  describe service('memcached') do
    it { should_not be_running }
  end
end

describe "main memcached class applies successfully" do
  describe command("puppet apply --test -e 'include memcached'") do
    its(:exit_status) { should eq 2 }
  end
end

describe "memcached is installed" do
  describe package('memcached') do
    it { should be_installed }
  end
end

describe "memcached service is started" do
  describe service('memcached') do
    it { should be_running }
  end
end

describe "memcached::instance resource applies successfully" do
  describe command("puppet apply --test -e 'memcached::instance{\"11222\":}'") do
    its(:exit_status) { should eq 2 }
  end
end

describe "memcached@11222 is running" do
  describe service('memcached@11222') do
    it { should be_running }
  end
end
