I believe that you can do this:

```ruby
provider.expects(:execpipe).twice.raises(Puppet::ExecutionFailure.new("ERROR!"))
```