diff --git a/spec/ui_spec.rb b/spec/ui_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/ui_spec.rb
+++ b/spec/ui_spec.rb
@@ -343,6 +343,7 @@ EOF
         invoke.call
       end
       @stdout_mock.invoke unless @stdout_mock.nil?
+      @stderr_mock.invoke unless @stderr_mock.nil?
     end
 
     def setup_remote(remote, options = {:user => nil, :project => "project"})
@@ -383,6 +384,17 @@ EOF
       @stdout_mock
     end
 
+    def stderr
+      if @stderr_mock.nil?
+        output = ""
+        @stderr_mock = DeferredMock.new(output)
+        STDERR.should_receive(:write).any_number_of_times do |str|
+          output << str
+        end
+      end
+      @stderr_mock
+    end
+
     class DeferredMock
       def initialize(obj = nil)
         @obj = obj
stderr can now be mocked like stdout in ui_spec