Sha256: 629794df25ae617e3f429f1fa144407f5cb9de6b8c91feccdfefbee4816add8e

Contents?: true

Size: 1.47 KB

Versions: 4

Compression:

Stored size: 1.47 KB

Contents

require 'spec_helper'
require 'lucid/ast/step_invocation'

module Lucid
  module AST
    describe StepInvocation do
      let(:step_invocation) do
        matched_cells = []
        StepInvocation.new(double, double, double, matched_cells)
      end

      describe 'filtering backtraces' do
        context 'when enabled' do
          before { Lucid.stub use_full_backtrace: false }

          it "removes lines with 'gems' in the path" do
            original_backtrace = ['/foo/bar/gems/baz', '/path/to/my/file.rb']
            exception = StandardError.new
            exception.set_backtrace(original_backtrace)
            result = step_invocation.filter_backtrace(exception).backtrace
            result.should == ['/path/to/my/file.rb']
          end

          it "removes lines with '.gem' in the path" do
            original_backtrace = ['/foo/bar/.gem/baz', '/path/to/my/file.rb']
            exception = StandardError.new
            exception.set_backtrace(original_backtrace)
            result = step_invocation.filter_backtrace(exception).backtrace
            result.should == ['/path/to/my/file.rb']
          end
        end

        context 'when disabled' do
          before { Lucid.stub use_full_backtrace: true }

          it 'return the exception unmodified' do
            exception = double
            step_invocation.filter_backtrace(exception).should == exception
          end
        end
      end
      
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lucid-0.4.1 spec/lucid/ast/step_invocation_spec.rb
lucid-0.4.0 spec/lucid/ast/step_invocation_spec.rb
lucid-0.3.3 spec/lucid/ast/step_invocation_spec.rb
lucid-0.3.0 spec/lucid/ast/step_invocation_spec.rb