Advertisement
fatmcgav

Negative stub test

Jan 21st, 2014
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.72 KB | None | 0 0
  1.       it "should fail an invalid file path" do
  2.         File.stubs(:exists?).with('/tmp/nonexistent').returns(:false)
  3.         expect { described_class.new(:domainname => 'domain', :passwordfile => '/tmp/nonexistent') }.to raise_error(Puppet::Error, /does not exist/)
  4.       end
  5.  
  6. --
  7.   1) Puppet::Type::Domain when validating values for passwordfile should fail an invalid file path
  8.      Failure/Error: expect { described_class.new(:domainname => 'domain', :passwordfile => '/tmp/nonexistent') }.to raise_error(Puppet::Error, /does not exist/)
  9.        expected Puppet::Error with message matching /does not exist/ but nothing was raised
  10.      # ./spec/unit/puppet/type/domain_spec.rb:132:in `block (4 levels) in <top (required)>'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement