Sha256: 8ea570fc94f14625559cf9cc5a1b5b8aebd1712dbe7f819fb6392b8d8c1dbac8

Contents?: true

Size: 1.3 KB

Versions: 9

Compression:

Stored size: 1.3 KB

Contents

require "spec_helper"
require "shared/configured"

describe MetricFu::Configuration, "for formatters" do
  it_behaves_like "configured" do
    describe "#configure_formatter" do
      before(:each) { get_new_config }

      context "given a built-in formatter" do
        before do
          @config.configure_formatter("html")
        end

        it "adds to the list of formatters" do
          expect(@config.formatters.first).to be_an_instance_of(MetricFu::Formatter::HTML)
        end
      end

      context "given a custom formatter by class name" do
        before do
          stub_const("MyCustomFormatter", Class.new { def initialize(*); end })
          @config.configure_formatter("MyCustomFormatter")
        end

        it "adds to the list of formatters" do
          expect(@config.formatters.first).to be_an_instance_of(MyCustomFormatter)
        end
      end

      context "given multiple formatters" do
        before do
          stub_const("MyCustomFormatter", Class.new { def initialize(*); end })
          @config.configure_formatter("html")
          @config.configure_formatter("yaml")
          @config.configure_formatter("MyCustomFormatter")
        end

        it "adds each to the list of formatters" do
          expect(@config.formatters.count).to eq(3)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
metric_fu-4.13.0 spec/metric_fu/formatter/configuration_spec.rb
fastruby-metric_fu-5.0.0 spec/metric_fu/formatter/configuration_spec.rb
code_metric_fu-4.14.4 spec/metric_fu/formatter/configuration_spec.rb
code_metric_fu-4.14.3 spec/metric_fu/formatter/configuration_spec.rb
code_metric_fu-4.14.2 spec/metric_fu/formatter/configuration_spec.rb
code_metric_fu-4.14.1 spec/metric_fu/formatter/configuration_spec.rb
code_metric_fu-4.14.0 spec/metric_fu/formatter/configuration_spec.rb
metric_fu-4.12.0 spec/metric_fu/formatter/configuration_spec.rb
metric_fu-4.11.4 spec/metric_fu/formatter/configuration_spec.rb