Sha256: 4a26b381d71dabb3dc6eba07472a695c838e16046b861d114b057eaebd628024

Contents?: true

Size: 970 Bytes

Versions: 2

Compression:

Stored size: 970 Bytes

Contents

# frozen_string_literal: true

describe Nanoc::CLI::ErrorHandler do
  subject(:error_handler) { described_class.new }

  describe '#forwards_stack_trace?' do
    subject { error_handler.forwards_stack_trace? }

    context 'feature enabled' do
      around do |ex|
        Nanoc::Feature.enable(Nanoc::Feature::SENSIBLE_STACK_TRACES) do
          ex.run
        end
      end

      context 'Ruby 2.4' do
        it { is_expected.to be(true) }
      end

      context 'Ruby 2.5' do
        it { is_expected.to be(true) }
      end
    end

    context 'feature not enabled' do
      context 'Ruby 2.4' do
        before do
          expect(error_handler).to receive(:ruby_version).and_return('2.4.2')
        end

        it { is_expected.to be(false) }
      end

      context 'Ruby 2.5' do
        before do
          expect(error_handler).to receive(:ruby_version).and_return('2.5.0')
        end

        it { is_expected.to be(true) }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-4.8.12 spec/nanoc/cli/error_handler_spec.rb
nanoc-4.8.11 spec/nanoc/cli/error_handler_spec.rb