Merge pull request #227 from daniellawrence/file_perms_apt_ppa
[puppet-modules/puppetlabs-apt.git] / spec / defines / builddep_spec.rb
index d60a330e0c1ad538b76e8cc39a863792711083af..a0cbaa4cc098e80acde84a7951788d1f64d31698 100644 (file)
@@ -1,17 +1,18 @@
 require 'spec_helper'
 describe 'apt::builddep', :type => :define do
 
+  let(:facts) { { :lsbdistid => 'Debian' } }
   let(:title) { 'my_package' }
 
-  describe "should succeed with a Class['apt']" do
-    let(:pre_condition) { 'class {"apt": } ' }
-
-    it { should contain_exec("apt-update-#{title}").with_command("/usr/bin/apt-get update").with_refreshonly(true) }
-  end
-
-  describe "should fail without Class['apt']" do
-    it { expect {should contain_exec("apt-update-#{title}").with_command("/usr/bin/apt-get update").with_refreshonly(true) }\
-      .to raise_error(Puppet::Error)
+  describe "should require apt-get update" do
+    it { should contain_exec("apt_update").with({
+        'command' => "/usr/bin/apt-get update",
+        'refreshonly' => true
+      })
+    }
+    it { should contain_anchor("apt::builddep::my_package").with({
+        'require' => 'Class[Apt::Update]',
+      })
     }
   end