Sha256: 8ef6b5bc35c27bb6ac63a6f58bb28d4e786b9320d40ea0f030e228ab605b873f
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
require "spec_helper" require "teaspoon/coverage" describe Teaspoon::Coverage do subject { Teaspoon::Coverage.new({"foo" => "bar"}) } describe "#reports" do before do Teaspoon.configuration.should_receive(:coverage_reports).and_return(["text", "text-summary", "html"]) subject.stub(:generate_report) { |i, f| "_#{f}_report_" } 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 = 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") subject.should_receive(:generate_report).with(@output, "text-summary") subject.should_receive(:generate_report).with(@output, "html") expect(subject.reports).to eq("\n_text_report_\n\n_text-summary_report_\n") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
teaspoon-0.7.4 | spec/teaspoon/coverage_spec.rb |