Sha256: a4951f747fccc549374f1388d56a224f20821a5523b6cae10c65cdc3fd2e1eb5

Contents?: true

Size: 1.21 KB

Versions: 5

Compression:

Stored size: 1.21 KB

Contents

# encoding: utf-8

describe "Rake::Task['check:coverage: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::Suit::Utils::System utility.

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

  describe ".invoke", :sandbox 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 "displays the default output" do
        expect { subject }.to change { commands }.to [
          "launchy tmp/coverage/index.html"
        ]
      end
    end

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

      let(:output) { "tmp/coverage" }
      before do
        prepare_settings "simplecov" => { "output" => output }
      end

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

      it "uses the custom output folder" do
        expect { subject }.to change { commands }.to [
          "launchy #{ output }/index.html"
        ]
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hexx-suit-0.2.2 spec/tests/tasks/check/coverage/display_spec.rb
hexx-suit-0.2.1 spec/tests/tasks/check/coverage/display_spec.rb
hexx-suit-0.2.0 spec/tests/tasks/check/coverage/display_spec.rb
hexx-suit-0.1.0 spec/tests/tasks/check/coverage/display_spec.rb
hexx-suit-0.0.1 spec/tests/tasks/check/coverage/display_spec.rb