Sha256: 752f3074ee067dae32a596d61d877de93495e4005616bc6af2ac1d97e76c7b4e

Contents?: true

Size: 1.71 KB

Versions: 7

Compression:

Stored size: 1.71 KB

Contents

require "spec_helper"
require "shared/configured"

describe MetricFu::Configuration, "for rails_best_practices" do
  it_behaves_like "configured" do
    describe "if #rails? is true " do
      before(:each) do
        @config = MetricFu.configuration
        allow(@config).to receive(:rails?).and_return(true)
        @config.reset
        MetricFu.configure
        %w(rails_best_practices).each do |metric|
          load_metric metric
        end
      end

      describe "#set_graphs " do
        it "should set the graphs to include rails_best_practices" do
          expect(MetricFu::Metric.get_metric(:rails_best_practices).has_graph?).to be_truthy
        end
      end

      it "should default @rails_best_practices to { :silent => true }" do
        load_metric "rails_best_practices"
        rbp = MetricFu::MetricRailsBestPractices.new
        expect(rbp.run_options).to eq(exclude: [], silent: true)
      end

      it "can configure @rails_best_practices 'exclude' using the sugar" do
        load_metric "rails_best_practices"
        rbp = MetricFu::Metric.get_metric(:rails_best_practices)
        rbp.exclude = ["config/chef"]
        expect(rbp.run_options).to eq(
                                     exclude: ["config/chef"],
                                     silent: true
                                   )

      end
    end

    describe "if #rails? is false " do
      before(:each) do
        get_new_config
        allow(@config).to receive(:rails?).and_return(false)
        %w(rails_best_practices).each do |metric|
          load_metric metric
        end
      end

      it "should set the registered code_dirs to ['lib']" do
        expect(directory("code_dirs")).to eq(["lib"])
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
metric_fu-4.13.0 spec/metric_fu/metrics/rails_best_practices/configuration_spec.rb
fastruby-metric_fu-5.0.0 spec/metric_fu/metrics/rails_best_practices/configuration_spec.rb
code_metric_fu-4.14.4 spec/metric_fu/metrics/rails_best_practices/configuration_spec.rb
code_metric_fu-4.14.3 spec/metric_fu/metrics/rails_best_practices/configuration_spec.rb
code_metric_fu-4.14.2 spec/metric_fu/metrics/rails_best_practices/configuration_spec.rb
code_metric_fu-4.14.1 spec/metric_fu/metrics/rails_best_practices/configuration_spec.rb
code_metric_fu-4.14.0 spec/metric_fu/metrics/rails_best_practices/configuration_spec.rb