Sha256: 14cc411a9402b09bbb569eb943676d13400ebadbc110738c51f23b841e39c6b7

Contents?: true

Size: 1.34 KB

Versions: 4

Compression:

Stored size: 1.34 KB

Contents

require File.dirname(__FILE__) + '/spec_helper.rb'

describe MetricFu::Base::Generator do
  describe "save_html" do
    it "should save to a index.html in the base_dir" do
      @generator = MetricFu::Base::Generator.new('base_dir')
      @generator.should_receive(:open).with("base_dir/index.html", "w")
      @generator.save_html("<html>")
    end

    it "should save to a custom.html to the base_dir if 'custom' is passed as name" do
      @generator = MetricFu::Base::Generator.new('base_dir')
      @generator.should_receive(:open).with("base_dir/metric_fu/custom.html", "w")
      @generator.save_html("<html>", 'metric_fu/custom')
    end
  end

  describe "generate_report class method" do
    it "should create a new Generator and call generate_report on it" do
      @generator = mock('generator')
      @generator.should_receive(:generate_report)
      MetricFu::Base::Generator.should_receive(:new).and_return(@generator)
      MetricFu::Base::Generator.generate_report('base_dir')
    end
  end

  describe "generate_report" do
    it "should create a new Generator and call generate_report on it" do
      @generator = MetricFu::Base::Generator.new('other_dir')
      @generator.should_receive(:open).with("other_dir/index.html", "w")
      @generator.should_receive(:generate_html).and_return('<html>')
      @generator.generate_report
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
indirect-metric_fu-0.8.2 spec/base_spec.rb
p8-metric_fu-0.8.2 spec/base_spec.rb
p8-metric_fu-0.8.3 spec/base_spec.rb
p8-metric_fu-0.8.4 spec/base_spec.rb