spec/teabag/coverage_spec.rb in teabag-0.7.2 vs spec/teabag/coverage_spec.rb in teabag-0.7.3

- old
+ new

@@ -8,19 +8,21 @@ describe "#reports" do before do Teabag.configuration.should_receive(:coverage_reports).and_return(["text", "text-summary", "html"]) subject.stub(:generate_report) { |i, f| "_#{f}_report_" } - File.stub(:write) + File.stub(:open) path = nil Dir.mktmpdir { |p| path = p } Dir.stub(:mktmpdir).and_yield(path) @output = File.join(path, "coverage.json") end it "writes the data to a file" do - File.should_receive(:write).with(@output, '{"foo":"bar"}') + file = mock('file') + File.should_receive(:open).with(@output, "w").and_yield(file) + file.should_receive(:write).with('{"foo":"bar"}') subject.reports end it "collects the results and returns them" do subject.should_receive(:generate_report).with(@output, "text")