Sha256: 5466a2fff3de65f88f40cd6682be37f41071cf742b1dd9adaf8be6fa5a468701

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

# encoding: utf-8

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

  let(:metric) { Hexx::Suit::Metrics::Yardstick }
  let(:task)   { Rake::Task["check:yardstick:display"] }

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

    subject { try_in_sandbox { task.invoke } }

    context "when '.metrics.yml' is absent" do

      it "loads the metric" do
        expect(metric).to receive :load
        subject
      end

      it "prepares the output file and displays it" do
        expect { subject }.to change { commands }.to [
          "mkdir tmp/yardstick -p",
          "touch tmp/yardstick/output.log",
          "cat tmp/yardstick/output.log"
        ]
      end
    end

    context "when '.metrics.yml' is present" do

      let(:options) { { "output" => "custom/yardstick.log" } }
      before { prepare_settings options, "config/metrics/yardstick.yml" }

      it "loads the metric" do
        expect(metric).to receive :load
        subject
      end

      it "uses the output" do
        expect { subject }.to change { commands }.to [
          "mkdir custom -p",
          "touch custom/yardstick.log",
          "cat custom/yardstick.log"
        ]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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