Sha256: 5a7722b0db23aa2a7ec9df298044f811d61822aef2d91beab26992f679ccd606

Contents?: true

Size: 1.36 KB

Versions: 6

Compression:

Stored size: 1.36 KB

Contents

# encoding: utf-8

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

  # The {#commands} variable is defined in the spec/support/config/tasks.rb
  # It collects the list of commands, that has been sent to system by
  # any instance of Hexx::RSpec::System utility.

  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

6 entries across 6 versions & 1 rubygems

Version Path
hexx-suit-2.2.3 spec/tests/tasks/check/yardstick/display_spec.rb
hexx-suit-2.2.2 spec/tests/tasks/check/yardstick/display_spec.rb
hexx-suit-2.2.1 spec/tests/tasks/check/yardstick/display_spec.rb
hexx-suit-2.2.0 spec/tests/tasks/check/yardstick/display_spec.rb
hexx-suit-2.1.0 spec/tests/tasks/check/yardstick/display_spec.rb
hexx-suit-2.0.0 spec/tests/tasks/check/yardstick/display_spec.rb