Sha256: 3aa7adf4996a4ec134aed2aa37c243f2d58a6700bd83b59daa645cd7dbe49be7

Contents?: true

Size: 1.22 KB

Versions: 9

Compression:

Stored size: 1.22 KB

Contents

# encoding: utf-8
require "spec_helper"

describe Hexx::Suit::Metrics::Rubocop, :sandbox do

  shared_context "without rubocop.yml" do

    let(:options) do
      { "output" => "tmp/rubocop/index.html", "format" => "html" }
    end
  end

  shared_context "with rubocop.yml" do

    let(:options) do
      { "output" => "custom/rubocop.html", "format" => "custom" }
    end

    before { prepare_settings options, "config/metrics/rubocop.yml" }
  end

  shared_examples "environments loader" do

    before { ENV["RUBOCOP_OUTPUT"] = nil }
    before { ENV["RUBOCOP_FORMAT"] = nil }

    it "[sets RUBOCOP_OUTPUT]" do
      expect { subject }
        .to change { ENV["RUBOCOP_OUTPUT"] }
        .to options["output"]
    end

    it "[sets RUBOCOP_FORMAT]" do
      expect { subject }
        .to change { ENV["RUBOCOP_FORMAT"] }
        .to options["format"]
    end
  end

  describe ".load" do

    subject { try_in_sandbox { described_class.load } }

    context "when rubocop.yml is absent" do

      include_context "without rubocop.yml"

      it_behaves_like "environments loader"
    end

    context "when rubocop.yml is present" do

      include_context "with rubocop.yml"

      it_behaves_like "environments loader"
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hexx-suit-1.5.0-x86_64-linux spec/tests/lib/metrics/rubocop_spec.rb
hexx-suit-1.3.0-x86_64-linux spec/tests/lib/metrics/rubocop_spec.rb
hexx-suit-1.2.0 spec/tests/lib/metrics/rubocop_spec.rb
hexx-suit-1.0.0 spec/tests/lib/metrics/rubocop_spec.rb
hexx-suit-0.2.2 spec/tests/lib/metrics/rubocop_spec.rb
hexx-suit-0.2.1 spec/tests/lib/metrics/rubocop_spec.rb
hexx-suit-0.2.0 spec/tests/lib/metrics/rubocop_spec.rb
hexx-suit-0.1.0 spec/tests/lib/metrics/rubocop_spec.rb
hexx-suit-0.0.1 spec/tests/lib/metrics/rubocop_spec.rb