Geminstaller C0 Coverage Information - RCov

spec/unit/output_listener_spec.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
spec/unit/output_listener_spec.rb 40 35
100.00%
100.00%

Key

Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.

Coverage Details

1 dir = File.dirname(__FILE__)
2 require File.expand_path("#{dir}/../helper/spec_helper")
3 
4 describe "an OutputListener" do
5   before(:each) do
6     @output_listener = GemInstaller::OutputListener.new
7     @mock_output_filter = mock("mock output filter")
8     @output_listener.output_filter = @mock_output_filter
9   end
10   
11   it "should queue all output of which it is notified, return it without flushing for read, and flush it upon read!" do
12     @output_listener.output_filter = nil
13     msg1 = 'msg1'
14     msg2 = 'msg2'
15     @output_listener.notify(msg1)
16     @output_listener.notify(msg2)
17     @output_listener.read.should==([msg1, msg2])
18     @output_listener.read!.should==([msg1, msg2])
19     @output_listener.read!.should==([])
20   end
21   
22   it "should echo all output, and stop echoing if echo is disabled" do
23     echo = "this should be echoed"
24     @mock_output_filter.should_receive(:rubygems_output).once.with(:stdout, echo)
25     @output_listener.notify(echo)
26   end
27   
28   it "should call sysout or sysin on based on output_stream property" do
29     stdout = "stdout"
30     stderr = "stderr"
31     @mock_output_filter.should_receive(:rubygems_output).once.with(:stdout, stdout)
32     @mock_output_filter.should_receive(:rubygems_output).once.with(:stderr, stderr)
33     @output_listener.notify(stdout, :stdout)
34     @output_listener.notify(stderr, :stderr)
35   end
36 
37   it "should raise error if invalid stream is specified" do
38     lambda { @output_listener.notify('foo',:invalid_stream) }.should raise_error(GemInstaller::GemInstallerError)
39   end
40 end

Generated on Mon May 10 23:40:29 -0700 2010 with rcov 0.9.8