Sha256: 0333f990297f40a110da2eed667c0bbf767d6a9d48b3aae8734dcd65bb4655c8

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

# encoding: utf-8

describe "Rake::Task['check:rubocop:display']", :tasks do

  let(:task)   { Rake::Task["check:rubocop:display"] }

  shared_context "without rubocop.yml" do

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

  shared_context "with rubocop.yml" do

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

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

  shared_examples "metric loader" do

    after { subject }

    it "[loads rubocop]" do
      expect(Hexx::Suit::Metrics::Rubocop).to receive :load
    end
  end

  shared_examples "results displayer" do

    it "displays rubocop results" do
      expect { subject }
        .to change { commands }
        .to ["launchy #{options['output']}"]
    end
  end

  describe ".invoke", :sandbox, :capture do

    subject { try_in_sandbox { task.invoke } }

    context "when .metrics.yml is absent" do

      include_context "without rubocop.yml"

      it_behaves_like "metric loader"
      it_behaves_like "results displayer"
    end

    context "when .metrics.yml is present" do

      include_context "with rubocop.yml"

      it_behaves_like "metric loader"
      it_behaves_like "results displayer"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hexx-suit-2.3.2 spec/tests/tasks/check/rubocop/display_spec.rb
hexx-suit-2.3.0 spec/tests/tasks/check/rubocop/display_spec.rb